/* ═══════════════════════════════════════════════════════════════════════════
   Monte Carlo — Design System CSS
   Redesigned: single-column stacked panels, pop-up modals, clean KPI strip
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Fonts ─────────────────────────────────────────────────────────────── */
@font-face {
  font-family: 'Azonix';
  src: url('css/Azonix.otf') format('opentype');
  font-display: swap;
}

/* ── Design tokens ──────────────────────────────────────────────────────── */
:root {
  /* Blue */
  --mc-blue-950: #071936;
  --mc-blue-900: #0a1f44;
  --mc-blue-850: #0f2a5a;
  --mc-blue-800: #17396f;
  --mc-blue-700: #1e3a8a;
  --mc-blue-600: #2f4eb2;
  --mc-blue-500: #3b82f6;
  --mc-blue-400: #60a5fa;
  --mc-blue-300: #93c5fd;
  /* Slate */
  --mc-slate-950: #020617;
  --mc-slate-900: #0f172a;
  --mc-slate-800: #1e293b;
  --mc-slate-700: #334155;
  --mc-slate-600: #475569;
  --mc-slate-500: #64748b;
  --mc-slate-400: #94a3b8;
  --mc-slate-300: #cbd5e1;
  --mc-slate-200: #e2e8f0;
  --mc-slate-100: #f1f5f9;
  --mc-slate-50:  #f8fafc;
  --mc-white: #ffffff;
  /* Accent */
  --mc-gold-500: #d6a74f;
  --mc-gold-200: #f8e7be;
  /* Status */
  --mc-success-bg: #dcfce7;
  --mc-success-fg: #166534;
  --mc-warning-bg: #fef3c7;
  --mc-warning-fg: #92400e;
  --mc-danger-bg:  #fee2e2;
  --mc-danger-fg:  #b91c1c;
  /* Misc */
  --mc-line:        #e2e8f0;
  --mc-shadow:      0 24px 70px rgba(15, 23, 42, 0.10);
  --mc-soft-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
  --mc-card-radius:  18px;
  --mc-panel-radius: 22px;
  --mc-modal-radius: 26px;
}

/* ── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body.mc-body {
  min-height: 100vh;
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
               'Segoe UI', sans-serif;
  background: #f0f4f8;
  color: var(--mc-slate-800);
  line-height: 1.5;
}

.mc-body button,
.mc-body input,
.mc-body select,
.mc-body textarea { font: inherit; }


/* ═══════════════════════════════════════════════════════════════════════════
   TOPBAR
   ═══════════════════════════════════════════════════════════════════════════ */

.mc-project-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: #0f2a5a;
  color: #eaf2ff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 28px rgba(7, 25, 54, 0.22);
}

.mc-project-topbar .inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  flex-wrap: nowrap;
}

.mc-project-topbar .brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: #eaf2ff;
  text-decoration: none;
  flex-shrink: 0;
}

.mc-project-topbar .brand img {
  width: auto;
  height: 60px;
  flex-shrink: 0;
}

.mc-project-topbar .title {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
}

.mc-project-topbar .title b {
  font-family: 'Azonix', sans-serif;
  letter-spacing: 0.5px;
  font-size: 26px;
  white-space: nowrap;
}

.mc-project-topbar .title small {
  font-family: sans-serif;
  font-style: italic;
  font-size: 11px;
  font-weight: 400;
  white-space: nowrap;
  opacity: 0.85;
}

.mc-project-topbar .right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  flex-wrap: nowrap;
}

.mc-project-topbar select {
  min-width: 140px;
  max-width: 200px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  color: #eaf2ff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.mc-project-topbar select:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.35);
}

.mc-project-topbar select option {
  background: #0f2a5a;
  color: #eaf2ff;
}

.mc-project-topbar .chip {
  padding: 6px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, #a78bfa, #60a5fa);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  flex-shrink: 0;
}

.mc-project-topbar .user-badge {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  color: #eaf2ff;
  font-weight: 700;
  flex-shrink: 0;
}

.mc-project-topbar .logout {
  padding: 8px 12px;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.14);
  color: #eaf2ff;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s;
}

.mc-project-topbar .logout:hover {
  background: rgba(255, 255, 255, 0.26);
}


/* ═══════════════════════════════════════════════════════════════════════════
   PAGE SHELL & CONTAINER
   ═══════════════════════════════════════════════════════════════════════════ */

.mc-page-shell { padding: 0 0 56px; }

.mc-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 32px;
}


/* ═══════════════════════════════════════════════════════════════════════════
   PAGE HEADER
   ═══════════════════════════════════════════════════════════════════════════ */

.mc-page-hd {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 28px 0 22px;
  flex-wrap: wrap;
}

.mc-page-hd-left { min-width: 0; flex: 1; }

.mc-page-hd-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.mc-breadcrumb {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 10px;
  color: var(--mc-slate-400);
  font-size: 12.5px;
  font-weight: 600;
}

.mc-breadcrumb a {
  color: var(--mc-slate-400);
  text-decoration: none;
  transition: color 0.15s;
}

.mc-breadcrumb a:hover { color: var(--mc-blue-600); }

.mc-breadcrumb svg { opacity: 0.5; flex-shrink: 0; }

.mc-page-title {
  margin: 0 0 6px;
  font-family: 'Azonix', sans-serif;
  font-size: clamp(22px, 3vw, 30px);
  color: var(--mc-blue-850);
  letter-spacing: 0.3px;
  line-height: 1.1;
}

.mc-page-subtitle {
  margin: 0;
  color: var(--mc-slate-500);
  font-size: 14px;
  line-height: 1.65;
  max-width: 560px;
}

/* ── Nav button ─────────────────────────────────────────────────────────── */
.mc-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border: 1.5px solid var(--mc-line);
  border-radius: 12px;
  background: var(--mc-white);
  color: var(--mc-slate-700);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.07);
  transition: all 0.18s ease;
  cursor: pointer;
  appearance: none;
}

.mc-nav-btn:hover {
  background: #eff6ff;
  border-color: rgba(59, 130, 246, 0.3);
  color: var(--mc-blue-700);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.1);
}

/* Legacy alias */
.btn-nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border: 2px solid var(--mc-blue-500);
  border-radius: 12px;
  background: var(--mc-white);
  color: var(--mc-blue-700);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
  appearance: none;
}

.btn-nav:hover  { background: #eff6ff; border-color: var(--mc-blue-600); }
.btn-nav.active { background: var(--mc-blue-500); color: #fff; }
.btn-nav:disabled { opacity: 0.55; cursor: not-allowed; }


/* ═══════════════════════════════════════════════════════════════════════════
   KPI STRIP
   ═══════════════════════════════════════════════════════════════════════════ */

.mc-kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.mc-kpi-tile {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 20px;
  border: 1px solid var(--mc-line);
  border-radius: var(--mc-card-radius);
  background: var(--mc-white);
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.mc-kpi-tile:hover {
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.10);
  transform: translateY(-2px);
}

.mc-kpi-tile-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  flex-shrink: 0;
  color: #fff;
}

.mc-kpi-tile-icon--blue    { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.mc-kpi-tile-icon--violet  { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }
.mc-kpi-tile-icon--emerald { background: linear-gradient(135deg, #10b981, #059669); }
.mc-kpi-tile-icon--amber   { background: linear-gradient(135deg, #f59e0b, #d97706); }

.mc-kpi-tile-body { min-width: 0; flex: 1; }

.mc-kpi-tile-label {
  display: block;
  margin-bottom: 4px;
  color: var(--mc-slate-500);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.mc-kpi-tile-value {
  display: block;
  margin-bottom: 3px;
  color: var(--mc-slate-900);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mc-kpi-tile-meta {
  display: block;
  color: var(--mc-slate-400);
  font-size: 11px;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}


/* ═══════════════════════════════════════════════════════════════════════════
   ACTION BAR
   ═══════════════════════════════════════════════════════════════════════════ */

.mc-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
  padding: 18px 24px;
  border: 1px solid rgba(59, 130, 246, 0.18);
  border-radius: var(--mc-card-radius);
  background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
  box-shadow: 0 2px 14px rgba(59, 130, 246, 0.07);
  flex-wrap: wrap;
}

.mc-action-bar-info { min-width: 0; flex: 1; }

.mc-action-bar-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  padding: 4px 10px;
  border: 1px solid rgba(59, 130, 246, 0.22);
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.08);
  color: var(--mc-blue-700);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.mc-action-bar-info p {
  margin: 0;
  color: var(--mc-slate-600);
  font-size: 13px;
  line-height: 1.5;
}

.mc-action-bar-btns {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  flex-wrap: wrap;
}


/* ═══════════════════════════════════════════════════════════════════════════
   STATUS BANNER
   ═══════════════════════════════════════════════════════════════════════════ */

.mc-status-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
  padding: 13px 18px;
  border: 1px solid transparent;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.55;
}

.mc-status-banner svg { flex-shrink: 0; margin-top: 1px; }

.mc-status-banner--info    { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }
.mc-status-banner--warning { background: var(--mc-warning-bg); border-color: #fcd34d; color: var(--mc-warning-fg); }
.mc-status-banner--error   { background: var(--mc-danger-bg); border-color: #fca5a5; color: var(--mc-danger-fg); }
.mc-status-banner--success { background: var(--mc-success-bg); border-color: #86efac; color: var(--mc-success-fg); }


/* ═══════════════════════════════════════════════════════════════════════════
   TAB NAVIGATION
   ═══════════════════════════════════════════════════════════════════════════ */

.mc-tabs-nav {
  margin-bottom: 18px;
  border-radius: 16px;
  background: var(--mc-white);
  border: 1px solid var(--mc-line);
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
  overflow: hidden;
}

.mc-tabs-scroll {
  display: flex;
  gap: 4px;
  padding: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.mc-tabs-scroll::-webkit-scrollbar { display: none; }

.mc-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--mc-slate-500);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.mc-tab-btn svg { flex-shrink: 0; opacity: 0.65; transition: opacity 0.18s; }

.mc-tab-btn:hover {
  background: var(--mc-slate-100);
  color: var(--mc-slate-700);
}

.mc-tab-btn.is-active {
  background: linear-gradient(135deg, var(--mc-blue-700), var(--mc-blue-500));
  color: var(--mc-white);
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.28);
}

.mc-tab-btn.is-active svg { opacity: 1; }

/* ── Tab body & content ─────────────────────────────────────────────────── */
.mc-tab-body { /* transparent wrapper */ }

.mc-tab-content         { display: none; }
.mc-tab-content.is-active { display: block; }


/* ═══════════════════════════════════════════════════════════════════════════
   PANEL STACK (single-column stacked layout, replaces mc-workspace-grid)
   ═══════════════════════════════════════════════════════════════════════════ */

.mc-panel-stack,
.mc-cost-stage,
.mc-schedule-stage {
  display: grid;
  gap: 16px;
  align-content: start;
}


/* ═══════════════════════════════════════════════════════════════════════════
   PANEL
   ═══════════════════════════════════════════════════════════════════════════ */

.mc-panel {
  padding: 24px;
  border: 1px solid var(--mc-line);
  border-radius: var(--mc-panel-radius);
  background: var(--mc-white);
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.06);
}

.mc-panel--inner {
  padding: 18px;
  border-radius: 16px;
}

.mc-panel--notice {
  background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
  border-color: rgba(59, 130, 246, 0.14);
}

.mc-panel--results {
  background: linear-gradient(160deg, #f8fafc 0%, #ffffff 100%);
  border-color: rgba(59, 130, 246, 0.11);
}

.mc-panel--run {
  background: linear-gradient(135deg, #f0fdf4 0%, #f8fafc 100%);
  border-color: rgba(34, 197, 94, 0.2);
}

.mc-panel--run .mc-panel-hd { margin-bottom: 0; }

.mc-panel--run select {
  padding: 6px 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 13px;
  background: #fff;
  cursor: pointer;
}

.mc-panel--compact { padding: 12px 16px; }

/* ── Panel header ───────────────────────────────────────────────────────── */
.mc-panel-hd {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.mc-panel-hd-left { min-width: 0; flex: 1; }

.mc-panel-hd-left h2,
.mc-panel-hd-left h3 {
  margin: 4px 0 6px;
  color: var(--mc-slate-900);
  font-size: 19px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.mc-panel-hd-left p {
  margin: 0;
  color: var(--mc-slate-500);
  font-size: 13px;
  line-height: 1.55;
}

.mc-panel-note {
  margin: -12px 0 16px;
  color: var(--mc-slate-500);
  font-size: 12px;
  line-height: 1.5;
}

.mc-panel-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
}

.mc-table-counter {
  padding: 5px 12px;
  border: 1px solid var(--mc-line);
  border-radius: 999px;
  background: var(--mc-slate-50);
  color: var(--mc-slate-600);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

/* ── Section / subsection headings ─────────────────────────────────────── */
.mc-section-heading,
.mc-subsection-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.mc-section-heading--tight  { margin-bottom: 4px; }

.mc-section-heading h2,
.mc-subsection-heading h3,
.mc-chart-card h3 {
  margin: 0;
  color: var(--mc-slate-900);
  font-size: 19px;
  font-weight: 800;
  line-height: 1.2;
}

.mc-section-heading p,
.mc-subsection-heading p {
  max-width: 560px;
  margin: 0;
  color: var(--mc-slate-500);
  font-size: 13px;
  line-height: 1.5;
}

.mc-section-heading--small h3 { font-size: 1rem; margin: 0; }

.mc-subsection-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 8px;
}


/* ═══════════════════════════════════════════════════════════════════════════
   STEP BADGE
   ═══════════════════════════════════════════════════════════════════════════ */

.mc-step {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--mc-gold-200), rgba(59, 130, 246, 0.12));
  color: var(--mc-blue-800);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}


/* ═══════════════════════════════════════════════════════════════════════════
   BUTTON SYSTEM
   ═══════════════════════════════════════════════════════════════════════════ */

.mc-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 18px;
  border: 1.5px solid transparent;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
}

.mc-btn svg { flex-shrink: 0; }

.mc-btn--primary {
  background: linear-gradient(135deg, var(--mc-blue-600), var(--mc-blue-700));
  color: var(--mc-white);
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(30, 58, 138, 0.32);
}

.mc-btn--primary:hover {
  background: linear-gradient(135deg, var(--mc-blue-500), var(--mc-blue-600));
  box-shadow: 0 6px 22px rgba(30, 58, 138, 0.4);
  transform: translateY(-1px);
}

.mc-btn--secondary {
  background: var(--mc-white);
  color: var(--mc-blue-700);
  border-color: rgba(59, 130, 246, 0.32);
  box-shadow: 0 1px 6px rgba(15, 23, 42, 0.07);
}

.mc-btn--secondary:hover {
  background: #eff6ff;
  border-color: var(--mc-blue-500);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.1);
}

.mc-btn--ghost {
  background: transparent;
  color: var(--mc-slate-700);
  border-color: var(--mc-line);
}

.mc-btn--ghost:hover {
  background: var(--mc-slate-50);
  border-color: var(--mc-slate-300);
  color: var(--mc-slate-800);
}

.mc-btn--danger {
  background: #fff7f7;
  color: var(--mc-danger-fg);
  border-color: #fecaca;
}

.mc-btn--danger:hover {
  background: var(--mc-danger-bg);
  border-color: #fca5a5;
}

.mc-btn--sm {
  padding: 6px 13px;
  font-size: 12px;
  border-radius: 9px;
}

.mc-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

@keyframes mc-pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.45); }
  50%       { box-shadow: 0 0 0 9px rgba(59, 130, 246, 0); }
}

.mc-btn--pulse { animation: mc-pulse-glow 1.8s ease infinite; }


/* ═══════════════════════════════════════════════════════════════════════════
   INLINE MESSAGES
   ═══════════════════════════════════════════════════════════════════════════ */

.mc-inline-message {
  padding: 13px 16px;
  border: 1px solid transparent;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.55;
  min-width: 0;
}

.mc-inline-message strong { display: block; margin-bottom: 4px; }

.mc-inline-message--info    { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }
.mc-inline-message--warning { background: var(--mc-warning-bg); border-color: #fcd34d; color: var(--mc-warning-fg); }
.mc-inline-message--error   { background: var(--mc-danger-bg); border-color: #fca5a5; color: var(--mc-danger-fg); }


/* ═══════════════════════════════════════════════════════════════════════════
   FORMS & FIELDS
   ═══════════════════════════════════════════════════════════════════════════ */

.mc-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.mc-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.mc-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.mc-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.mc-form-grid--2col { grid-template-columns: repeat(2, 1fr); }
.mc-form-grid--3col { grid-template-columns: repeat(3, 1fr); }
.mc-form-grid--4col { grid-template-columns: repeat(4, 1fr); }

.mc-field--wide { grid-column: 1 / -1; }

.mc-body label {
  color: var(--mc-slate-600);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.mc-body input,
.mc-body select,
.mc-body textarea {
  min-width: 0;
  padding: 10px 12px;
  border: 1.5px solid var(--mc-line);
  border-radius: 11px;
  background: var(--mc-white);
  color: var(--mc-slate-800);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.mc-body input:focus,
.mc-body select:focus,
.mc-body textarea:focus {
  border-color: var(--mc-blue-400);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.11);
}

.mc-field-help {
  margin: 0;
  color: var(--mc-slate-400);
  font-size: 11.5px;
  line-height: 1.5;
}

.mc-checkbox-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--mc-slate-700);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-transform: none;
  letter-spacing: normal;
}

.mc-checkbox-inline input {
  width: 15px;
  height: 15px;
  padding: 0;
  border-radius: 4px;
  cursor: pointer;
}

.mc-unit-pill,
.mc-executive-pill {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 800;
}

.mc-unit-pill {
  border: 1.5px dashed var(--mc-slate-300);
  background: var(--mc-slate-50);
  color: var(--mc-blue-700);
}

.mc-executive-pill {
  border: 1px solid #dbeafe;
  background: #eff6ff;
  color: var(--mc-blue-700);
}


/* ═══════════════════════════════════════════════════════════════════════════
   MODULE TOGGLE TILES
   ═══════════════════════════════════════════════════════════════════════════ */

.mc-module-toggle-grid { display: grid; gap: 10px; }

.mc-toggle-tile {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 14px;
  border: 1.5px solid var(--mc-line);
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.mc-toggle-tile:hover {
  transform: translateY(-1px);
  border-color: rgba(59, 130, 246, 0.28);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.mc-toggle-tile input { margin-top: 2px; width: 18px; height: 18px; }

.mc-toggle-tile-copy { display: grid; gap: 4px; min-width: 0; }
.mc-toggle-tile-copy strong { color: var(--mc-slate-900); font-size: 14px; }
.mc-toggle-tile-copy small  { color: var(--mc-slate-500); font-size: 12px; line-height: 1.45; }

.mc-toggle { display: inline-flex; align-items: center; gap: 8px; color: var(--mc-slate-700); font-weight: 700; }
.mc-toggle input { width: 18px; height: 18px; }


/* ═══════════════════════════════════════════════════════════════════════════
   TABLE
   ═══════════════════════════════════════════════════════════════════════════ */

.mc-table-wrap {
  overflow: auto;
  border: 1px solid var(--mc-line);
  border-radius: 16px;
  background: var(--mc-white);
}

.mc-table {
  width: 100%;
  min-width: 980px;
  border-collapse: separate;
  border-spacing: 0;
}

.mc-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 11px 12px;
  background: #f8fbff;
  border-bottom: 1px solid var(--mc-line);
  color: var(--mc-slate-600);
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: 0.09em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.mc-table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid #eef2f7;
  vertical-align: middle;
  color: var(--mc-slate-700);
  font-size: 13px;
}

.mc-table tbody tr:last-child td { border-bottom: none; }
.mc-table tbody tr:hover { background: rgba(59, 130, 246, 0.025); }
.mc-table tbody tr.is-selected { background: rgba(59, 130, 246, 0.06); }

.mc-table input[type='text'],
.mc-table input[type='number'],
.mc-table select {
  width: 100%;
  min-width: 110px;
  padding: 7px 9px;
  font-size: 12px;
  border-radius: 9px;
}

.mc-table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  color: var(--mc-slate-500);
  font-size: 13px;
}

.mc-empty-cell {
  text-align: center;
  color: var(--mc-slate-400);
  padding: 24px;
  font-size: 13px;
}


/* ═══════════════════════════════════════════════════════════════════════════
   KPI GRID (JS-generated)
   ═══════════════════════════════════════════════════════════════════════════ */

.mc-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.mc-kpi-grid--compact {
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  margin-bottom: 16px;
}

.mc-kpi-card,
.mc-metric-card {
  padding: 16px;
  border: 1px solid var(--mc-line);
  border-radius: 16px;
  background: var(--mc-white);
  box-shadow: 0 1px 6px rgba(15, 23, 42, 0.05);
}

.mc-kpi-card span,
.mc-summary-label,
.mc-metric-label,
.mc-cost-card span,
.mc-preview-stat span {
  display: block;
  margin-bottom: 7px;
  color: var(--mc-slate-500);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.mc-kpi-card strong,
.mc-cost-card strong {
  display: block;
  margin-bottom: 4px;
  color: var(--mc-slate-900);
  font-size: 22px;
  line-height: 1.14;
  letter-spacing: -0.02em;
  overflow-wrap: break-word;
  word-break: break-word;
}

.mc-kpi-card small,
.mc-cost-card small,
.mc-metric-card p {
  color: var(--mc-slate-400);
  font-size: 12px;
  line-height: 1.45;
}

.mc-metric-card strong {
  display: block;
  margin-bottom: 6px;
  color: var(--mc-slate-900);
  font-size: 22px;
  letter-spacing: -0.02em;
}


/* ═══════════════════════════════════════════════════════════════════════════
   COST SUMMARY GRID
   ═══════════════════════════════════════════════════════════════════════════ */

.mc-cost-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.mc-cost-card {
  padding: 16px;
  border: 1px solid var(--mc-line);
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  box-shadow: 0 1px 6px rgba(15, 23, 42, 0.05);
}


/* ═══════════════════════════════════════════════════════════════════════════
   CHIP ROW & BADGES
   ═══════════════════════════════════════════════════════════════════════════ */

.mc-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 16px;
}

.mc-source-badge,
.mc-source-chip,
.mc-badge,
.mc-source-stat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
}

.mc-source-badge,
.mc-badge { background: rgba(59, 130, 246, 0.1); color: var(--mc-blue-700); }

.mc-source-chip { border: 1px solid rgba(59, 130, 246, 0.16); background: #f8fbff; color: var(--mc-slate-700); }

.mc-source-stat { border: 1px solid var(--mc-line); background: var(--mc-white); color: var(--mc-slate-700); font-weight: 800; }

.mc-badge-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }


/* ═══════════════════════════════════════════════════════════════════════════
   SOURCE LIST
   ═══════════════════════════════════════════════════════════════════════════ */

.mc-source-list { display: grid; gap: 12px; }

.mc-source-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--mc-line);
  border-radius: 16px;
  background: linear-gradient(180deg, #f8fbff, #ffffff);
}

.mc-source-copy { min-width: 0; }
.mc-source-copy h3 { margin: 0 0 6px; color: var(--mc-slate-900); font-size: 16px; }
.mc-source-copy p  { margin: 0 0 10px; color: var(--mc-slate-600); font-size: 13px; line-height: 1.5; }
.mc-source-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.mc-source-action { display: grid; align-content: center; }

.mc-source-empty {
  padding: 24px;
  border: 1px dashed var(--mc-slate-300);
  border-radius: 16px;
  background: #f8fbff;
  color: var(--mc-slate-500);
  text-align: center;
  font-size: 13px;
}

.mc-source-empty strong { display: block; margin-bottom: 6px; color: var(--mc-slate-800); }


/* ═══════════════════════════════════════════════════════════════════════════
   MINI BUTTON
   ═══════════════════════════════════════════════════════════════════════════ */

.mc-mini-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 10px;
  border: 1px solid var(--mc-line);
  border-radius: 9px;
  background: var(--mc-white);
  color: var(--mc-slate-700);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.15s;
}

.mc-mini-btn:hover       { background: var(--mc-slate-50); }
.mc-mini-btn--danger     { border-color: #fecaca; background: #fff7f7; color: var(--mc-danger-fg); }


/* ═══════════════════════════════════════════════════════════════════════════
   CHART HOST & EDITOR HOST
   ═══════════════════════════════════════════════════════════════════════════ */

.mc-chart-host,
.mc-editor-host    { min-height: 240px; }
.mc-chart-host--tall    { min-height: 310px; }
.mc-chart-host--preview { min-height: 180px; }
.mc-history-host   { display: grid; gap: 12px; }

.mc-editor-empty,
.mc-chart-empty {
  display: grid;
  place-items: center;
  min-height: 200px;
  padding: 18px;
  border: 1px dashed var(--mc-slate-300);
  border-radius: 14px;
  background: linear-gradient(180deg, #f8fbff, #ffffff);
  color: var(--mc-slate-500);
  text-align: center;
}

.mc-editor-empty strong,
.mc-chart-empty strong { display: block; margin-bottom: 6px; color: var(--mc-slate-800); font-size: 15px; }

/* ── Chart card ─────────────────────────────────────────────────────────── */
.mc-chart-card {
  padding: 20px;
  border: 1px solid var(--mc-line);
  border-radius: 16px;
  background: var(--mc-white);
  box-shadow: 0 1px 6px rgba(15, 23, 42, 0.05);
}

.mc-chart-card h3 { margin: 0 0 4px; color: var(--mc-slate-900); font-size: 15px; font-weight: 700; }
.mc-chart-card p  { margin: 0 0 14px; color: var(--mc-slate-400); font-size: 12px; line-height: 1.5; }

.mc-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.mc-chart-caption { margin-top: 10px; color: var(--mc-slate-500); font-size: 11px; }

.mc-svg {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid #edf2f8;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}


/* ═══════════════════════════════════════════════════════════════════════════
   EDITOR LAYOUT
   ═══════════════════════════════════════════════════════════════════════════ */

.mc-editor-header {
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid var(--mc-line);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.06), rgba(214, 167, 79, 0.06));
}

.mc-editor-header h3 { margin: 0 0 8px; color: var(--mc-slate-900); font-size: 19px; }
.mc-editor-header p  { margin: 0; color: var(--mc-slate-600); font-size: 13px; line-height: 1.5; }

.mc-editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.mc-checkbox-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--mc-line);
  border-radius: 14px;
  background: var(--mc-slate-50);
}

.mc-checkbox-card strong { display: block; margin-bottom: 3px; color: var(--mc-slate-900); font-size: 14px; }
.mc-checkbox-card small  { color: var(--mc-slate-500); font-size: 12px; }

/* ── Preview stats ──────────────────────────────────────────────────────── */
.mc-preview-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.mc-preview-stat {
  padding: 12px;
  border: 1px solid var(--mc-line);
  border-radius: 12px;
  background: var(--mc-slate-50);
}

.mc-preview-stat strong { color: var(--mc-slate-900); font-size: 15px; font-weight: 800; }

/* ── Preview header ─────────────────────────────────────────────────────── */
.mc-preview-header { margin-bottom: 14px; }
.mc-preview-header h3 { margin: 4px 0 6px; color: var(--mc-slate-900); font-size: 15px; font-weight: 700; }
.mc-preview-header p  { margin: 0; color: var(--mc-slate-500); font-size: 12px; line-height: 1.5; }


/* ═══════════════════════════════════════════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════════════════════════════════════════ */

.mc-empty-state {
  display: grid;
  place-items: center;
  min-height: 280px;
  padding: 28px;
  border: 1px dashed var(--mc-slate-300);
  border-radius: 20px;
  background: linear-gradient(180deg, #f8fbff, #ffffff);
  text-align: center;
}

.mc-empty-state strong { display: block; margin-bottom: 8px; color: var(--mc-slate-900); font-size: 19px; }
.mc-empty-state p      { max-width: 700px; margin: 0; color: var(--mc-slate-500); font-size: 14px; line-height: 1.65; }


/* ═══════════════════════════════════════════════════════════════════════════
   CHECKLIST GRID
   ═══════════════════════════════════════════════════════════════════════════ */

.mc-checklist-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 4px;
}

.mc-checklist-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px;
  border: 1px solid rgba(59, 130, 246, 0.14);
  border-radius: 16px;
  background: var(--mc-white);
  box-shadow: 0 2px 10px rgba(59, 130, 246, 0.06);
}

.mc-checklist-num {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--mc-blue-500), var(--mc-blue-700));
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  flex-shrink: 0;
}

.mc-checklist-card strong { display: block; margin-bottom: 4px; color: var(--mc-slate-900); font-size: 14px; }
.mc-checklist-card p      { margin: 0; color: var(--mc-slate-500); font-size: 12px; line-height: 1.5; }


/* ═══════════════════════════════════════════════════════════════════════════
   PORTFOLIO — summary grid & cards
   ═══════════════════════════════════════════════════════════════════════════ */

.mc-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.mc-card {
  padding: 16px;
  border: 1px solid var(--mc-line);
  border-radius: 16px;
  background: var(--mc-white);
  box-shadow: 0 1px 6px rgba(15, 23, 42, 0.05);
}

.mc-card--danger  { border-color: #fecaca; background: #fff8f8; }
.mc-card--warning { border-color: #fcd34d; background: #fffdf0; }
.mc-card--success { border-color: #86efac; background: #f0fdf4; }

.mc-card-label {
  display: block;
  margin-bottom: 6px;
  color: var(--mc-slate-500);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.mc-card-value {
  color: var(--mc-slate-900);
  font-size: 20px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.mc-card--danger  .mc-card-value { color: var(--mc-danger-fg); }
.mc-card--warning .mc-card-value { color: var(--mc-warning-fg); }
.mc-card--success .mc-card-value { color: var(--mc-success-fg); }

/* ── Summary card (JS-generated) ────────────────────────────────────────── */
.mc-summary-card {
  padding: 16px;
  border: 1px solid var(--mc-line);
  border-radius: 18px;
  background: var(--mc-white);
  box-shadow: var(--mc-soft-shadow);
}

.mc-summary-card strong {
  display: block;
  margin-bottom: 6px;
  color: var(--mc-slate-900);
  font-size: 22px;
  line-height: 1.18;
  letter-spacing: -0.02em;
}

.mc-summary-card small { color: var(--mc-slate-500); font-size: 12px; line-height: 1.45; }


/* ═══════════════════════════════════════════════════════════════════════════
   ROW ACTIONS & SCENARIO ACTIONS
   ═══════════════════════════════════════════════════════════════════════════ */

.mc-scenario-actions,
.mc-execution-actions,
.mc-import-actions,
.mc-page-actions,
.mc-row-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.mc-import-actions { margin-bottom: 16px; }
.mc-scenario-actions { margin-top: 2px; }

.mc-row-summary { color: var(--mc-slate-600); font-size: 12px; line-height: 1.45; }


/* ═══════════════════════════════════════════════════════════════════════════
   DRIVERS LIST
   ═══════════════════════════════════════════════════════════════════════════ */

.mc-drivers-list { display: grid; gap: 10px; margin-top: 14px; }

.mc-driver-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  gap: 10px;
  align-items: center;
}

.mc-driver-copy { min-width: 0; }
.mc-driver-copy span { display: block; overflow: hidden; color: var(--mc-slate-700); font-size: 12px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.mc-driver-copy small { color: var(--mc-slate-500); font-size: 11px; }

.mc-driver-bar { margin-top: 6px; height: 8px; overflow: hidden; border-radius: 999px; background: var(--mc-slate-100); }
.mc-driver-bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--mc-blue-300), var(--mc-blue-600)); }


/* ═══════════════════════════════════════════════════════════════════════════
   RESULTS MODULES
   ═══════════════════════════════════════════════════════════════════════════ */

.mc-results-module { display: grid; gap: 16px; }

.mc-results-module + .mc-results-module {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--mc-line);
}

.mc-results-module--economic   { border-top: 3px solid #0f766e; padding-top: 4px; }
.mc-results-module--integrated { border-top: 3px solid var(--mc-gold-500); padding-top: 4px; }


/* ═══════════════════════════════════════════════════════════════════════════
   BAR LIST
   ═══════════════════════════════════════════════════════════════════════════ */

.mc-bar-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mc-bar-row {
  display: grid;
  grid-template-columns: minmax(80px, 180px) 1fr 80px 48px;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
}

.mc-bar-row span   { color: var(--mc-slate-600); font-size: 13px; font-weight: 700; }
.mc-bar-row strong { color: var(--mc-slate-900); font-size: 13px; text-align: right; }
.mc-bar-label { color: #374151; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.mc-bar-track { height: 10px; background: #e5e7eb; border-radius: 999px; overflow: hidden; }

.mc-bar-fill { height: 100%; border-radius: 999px; background: var(--mc-blue-500); transition: width 0.3s ease; }
.mc-bar-fill.danger,  .mc-bar-fill--danger  { background: #ef4444; }
.mc-bar-fill.success, .mc-bar-fill--success { background: #10b981; }
.mc-bar-fill.warning, .mc-bar-fill--warning { background: #f59e0b; }
.mc-bar-fill.neutral                        { background: var(--mc-slate-500); }

.mc-bar-value { color: #6b7280; text-align: right; white-space: nowrap; font-size: 0.75rem; }


/* ═══════════════════════════════════════════════════════════════════════════
   ECONOMIC CARDS
   ═══════════════════════════════════════════════════════════════════════════ */

.risk-type-threat      { color: #b91c1c; font-weight: 800; }
.risk-type-opportunity { color: #047857; font-weight: 800; }

.economic-recommendation {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 15px;
  font-weight: 900;
}

.economic-recommendation.success { background: #dcfce7; color: #166534; }
.economic-recommendation.warning { background: #fef3c7; color: #92400e; }
.economic-recommendation.danger  { background: #fee2e2; color: #991b1b; }
.economic-recommendation.neutral { background: #e2e8f0; color: #334155; }

.economic-decision-card {
  margin-bottom: 16px;
  padding: 22px;
  border-radius: 20px;
  color: #fff;
}

.economic-decision-card span   { display: block; margin-bottom: 6px; font-size: 13px; opacity: 0.9; }
.economic-decision-card strong { display: block; margin-bottom: 8px; font-size: 28px; letter-spacing: -0.02em; }
.economic-decision-card p      { margin: 0; font-size: 14px; line-height: 1.5; }

.economic-decision-card.success { background: linear-gradient(135deg, #059669, #10b981); }
.economic-decision-card.warning { background: linear-gradient(135deg, #b45309, #f59e0b); }
.economic-decision-card.danger  { background: linear-gradient(135deg, #b91c1c, #ef4444); }
.economic-decision-card.neutral { background: linear-gradient(135deg, #475569, #64748b); }


/* ═══════════════════════════════════════════════════════════════════════════
   MINI COLUMN CHART
   ═══════════════════════════════════════════════════════════════════════════ */

.mc-mini-column-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  min-height: 200px;
  padding: 14px 10px 6px;
}

.mc-mini-column {
  flex: 1 1 0;
  min-width: 10px;
  border-radius: 10px 10px 0 0;
  background: linear-gradient(180deg, #60a5fa, #1d4ed8);
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.18);
}


/* ═══════════════════════════════════════════════════════════════════════════
   SCENARIO PILLS
   ═══════════════════════════════════════════════════════════════════════════ */

.scenario-pill-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }

.scenario-pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  padding: 7px 12px;
  background: #eff6ff;
  color: #1e3a8a;
  font-size: 13px;
  font-weight: 800;
}

.risk-mitigation-box {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
  padding: 14px;
  border: 1px dashed var(--mc-slate-300);
  border-radius: 14px;
  background: var(--mc-slate-50);
}


/* ═══════════════════════════════════════════════════════════════════════════
   INTEGRATED SETTINGS
   ═══════════════════════════════════════════════════════════════════════════ */

.mc-integrated-settings {
  background: linear-gradient(135deg, #071936 0%, #0f2a5a 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  padding: 22px;
  color: #fff;
}

.mc-integrated-settings .mc-section-heading {
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  padding-bottom: 12px;
  margin-bottom: 16px;
}

.mc-integrated-settings h3 { font-size: 15px; font-weight: 700; margin: 4px 0 0; color: #fff; }
.mc-integrated-settings p  { font-size: 12px; color: var(--mc-slate-300); margin: 0; }
.mc-integrated-settings .mc-step { color: var(--mc-gold-500); }

.mc-integrated-fields {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  align-items: start;
}

.mc-integrated-settings label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--mc-blue-300);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.mc-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 8px 12px;
  color: #fff;
  font-size: 14px;
  outline: none;
}

.mc-input:focus {
  border-color: var(--mc-blue-400);
  background: rgba(255, 255, 255, 0.12);
}

.mc-input::placeholder { color: rgba(255, 255, 255, 0.35); }

.mc-integrated-settings .mc-field-help { font-size: 11px; color: var(--mc-slate-400); margin: 4px 0 0; }

.mc-integrated-settings .mc-unit-pill {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 8px;
  min-height: 36px;
  display: flex;
  align-items: center;
}

.mc-results-module--integrated { border-top: 3px solid var(--mc-gold-500); padding-top: 4px; }


/* ═══════════════════════════════════════════════════════════════════════════
   EXECUTIVE REPORT
   ═══════════════════════════════════════════════════════════════════════════ */

.executive-report-container {
  padding: 24px;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  background: #ffffff;
}

.executive-report { max-width: 980px; margin: 0 auto; color: #0f172a; }

.report-cover {
  margin-bottom: 24px;
  padding: 32px;
  border-radius: 20px;
  background: linear-gradient(135deg, #0f2a5a, #2563eb);
  color: #ffffff;
}

.report-eyebrow { margin-bottom: 8px; font-size: 12px; letter-spacing: 0.12em; opacity: 0.85; text-transform: uppercase; }
.report-cover h1 { margin: 0 0 12px; font-size: 34px; }
.report-cover p  { margin: 0 0 6px; line-height: 1.5; }

.report-section { margin-bottom: 28px; page-break-inside: avoid; }
.report-section h2 { margin-bottom: 12px; color: #0f172a; font-size: 22px; }

.report-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.report-kpi { padding: 16px; border: 1px solid #e2e8f0; border-radius: 14px; background: #f8fafc; }
.report-kpi span   { display: block; margin-bottom: 6px; color: #64748b; font-size: 12px; }
.report-kpi strong { display: block; color: #0f172a; font-size: 18px; }

.report-insights { padding-left: 20px; color: #334155; line-height: 1.7; }
.report-table { font-size: 12px; }
.scenario-comparison-table small, .report-table small { color: #64748b; }


/* ═══════════════════════════════════════════════════════════════════════════
   PORTFOLIO MATRIX & RISK PILLS
   ═══════════════════════════════════════════════════════════════════════════ */

.portfolio-matrix-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr auto;
  gap: 4px;
  position: relative;
  min-height: 280px;
  border: 1px solid var(--mc-line);
  border-radius: 8px;
  overflow: hidden;
}

.portfolio-matrix-quadrant {
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  gap: 4px;
  padding: 12px;
  min-height: 120px;
  border-radius: 4px;
}

.portfolio-matrix-quadrant.danger  { background: #fee2e2; border: 1px solid #fca5a5; }
.portfolio-matrix-quadrant.warning { background: #fef3c7; border: 1px solid #fcd34d; }
.portfolio-matrix-quadrant.success { background: #d1fae5; border: 1px solid #6ee7b7; }

.portfolio-matrix-label { font-size: 0.7rem; font-weight: 600; color: #6b7280; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 8px; width: 100%; }
.portfolio-matrix-count { font-weight: 400; }

.portfolio-matrix-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.12);
  font-size: 0.65rem;
  font-weight: 600;
  color: #374151;
  cursor: default;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portfolio-matrix-axis-x { grid-column: 1 / -1; text-align: center; font-size: 0.7rem; color: #6b7280; padding: 6px 0 2px; }
.portfolio-matrix-axis-y { display: none; }

.risk-level-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.risk-level-pill.high    { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.risk-level-pill.medium  { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.risk-level-pill.low     { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.risk-level-pill.no-sim  { background: #f1f5f9; color: #64748b; border: 1px solid #cbd5e1; text-transform: none; font-weight: 500; }

.mc-row-unsimulated td  { color: #94a3b8; font-style: italic; }
.mc-row-unsimulated td:first-child { color: #475569; font-style: normal; font-weight: 500; }
.btn-link-inline { color: #2563eb; text-decoration: underline; font-size: 0.82rem; background: none; border: none; cursor: pointer; padding: 0; font-style: normal; }

.correlation-table-wrapper { overflow-x: auto; border: 1px solid #e2e8f0; border-radius: 14px; background: #fff; }
.correlation-table input { width: 72px; min-height: 34px; border: 1px solid #cbd5e1; border-radius: 8px; padding: 4px 6px; text-align: center; color: #0f172a; }
.correlation-table input:disabled { background: #e2e8f0; color: #64748b; font-weight: 800; }

.portfolio-aggregate-highlight { border-radius: 18px; padding: 20px; background: linear-gradient(135deg, #0f2a5a, #2563eb); color: #fff; }
.portfolio-aggregate-highlight span   { display: block; margin-bottom: 6px; font-size: 13px; opacity: 0.85; }
.portfolio-aggregate-highlight strong { display: block; font-size: 30px; letter-spacing: -0.02em; }

.cache-status-pill { display: inline-flex; align-items: center; border-radius: 999px; padding: 5px 10px; font-size: 12px; font-weight: 800; background: #eff6ff; color: #1e3a8a; }


/* ═══════════════════════════════════════════════════════════════════════════
   MISC UTILITIES
   ═══════════════════════════════════════════════════════════════════════════ */

.mc-panel--compact { padding: 12px 16px; }
.mc-section-heading--small h3 { font-size: 1rem; margin: 0; }
.mc-subsection-title { font-size: 0.8rem; font-weight: 600; color: #6b7280; text-transform: uppercase; letter-spacing: 0.04em; margin: 0 0 8px; }

.mc-subtitle { margin: 16px 0 10px; color: var(--mc-slate-900); font-size: 15px; font-weight: 800; }

.mt-16 { margin-top: 16px; }


/* ═══════════════════════════════════════════════════════════════════════════
   TEST PAGE
   ═══════════════════════════════════════════════════════════════════════════ */

.test-status { display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 800; letter-spacing: 0.02em; }
.test-status.passed { background: #dcfce7; color: #166534; }
.test-status.failed { background: #fee2e2; color: #991b1b; }

.mc-code-block { background: #0f172a; color: #e2e8f0; border-radius: 12px; padding: 16px; font-family: monospace; font-size: 13px; overflow-x: auto; }

.security-warning { background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; border-radius: 12px; padding: 14px; font-weight: 700; }
.security-ok      { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; border-radius: 12px; padding: 14px; font-weight: 700; }

.mc-test-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.mc-test-card { background: var(--mc-white); border: 1px solid var(--mc-line); border-radius: 14px; padding: 20px; text-align: center; }
.mc-test-card span   { display: block; font-size: 12px; font-weight: 600; color: var(--mc-slate-500); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; }
.mc-test-card strong { display: block; font-size: 28px; font-weight: 800; color: var(--mc-slate-900); }


/* ═══════════════════════════════════════════════════════════════════════════
   MODALS  (HTML5 <dialog>)
   ═══════════════════════════════════════════════════════════════════════════ */

.mc-modal {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: 700px;
  max-height: 90vh;
  margin: auto;
  padding: 0;
  border: none;
  border-radius: var(--mc-modal-radius);
  background: transparent;
  overflow: visible;
  box-shadow: none;
}

.mc-modal--xl { max-width: 1080px; }

.mc-modal::backdrop {
  background: rgba(7, 25, 54, 0.54);
  backdrop-filter: blur(5px);
}

@keyframes mc-modal-in {
  from { opacity: 0; transform: translateY(22px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.mc-modal[open] {
  animation: mc-modal-in 0.24s cubic-bezier(0.34, 1.4, 0.64, 1) both;
}

.mc-modal-shell {
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  border: 1px solid var(--mc-line);
  border-radius: var(--mc-modal-radius);
  background: var(--mc-white);
  box-shadow:
    0 40px 100px rgba(7, 25, 54, 0.24),
    0 10px 30px rgba(7, 25, 54, 0.14);
  overflow: hidden;
}

/* ── Modal header ───────────────────────────────────────────────────────── */
.mc-modal-hd {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 28px 20px;
  border-bottom: 1px solid var(--mc-line);
  background: linear-gradient(135deg, #f8fafc, #eff6ff);
  flex-shrink: 0;
}

.mc-modal-title { min-width: 0; }

.mc-modal-title h2 {
  margin: 4px 0 0;
  color: var(--mc-slate-900);
  font-size: 20px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.mc-modal-title p {
  margin: 6px 0 0;
  color: var(--mc-slate-500);
  font-size: 13px;
  line-height: 1.5;
}

.mc-modal-close {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1.5px solid var(--mc-line);
  border-radius: 10px;
  background: var(--mc-white);
  color: var(--mc-slate-500);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.16s ease;
}

.mc-modal-close:hover {
  background: var(--mc-danger-bg);
  border-color: #fca5a5;
  color: var(--mc-danger-fg);
}

/* ── Modal body ─────────────────────────────────────────────────────────── */
.mc-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  scrollbar-width: thin;
  scrollbar-color: var(--mc-slate-300) transparent;
}

.mc-modal-body::-webkit-scrollbar       { width: 5px; }
.mc-modal-body::-webkit-scrollbar-track { background: transparent; }
.mc-modal-body::-webkit-scrollbar-thumb { background: var(--mc-slate-300); border-radius: 999px; }

.mc-modal-intro {
  margin: 0 0 22px;
  padding: 13px 16px;
  border: 1px solid rgba(59, 130, 246, 0.16);
  border-radius: 14px;
  background: #f0f7ff;
  color: var(--mc-slate-700);
  font-size: 13px;
  line-height: 1.6;
}

/* ── Modal footer ───────────────────────────────────────────────────────── */
.mc-modal-ft {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 28px;
  border-top: 1px solid var(--mc-line);
  background: #f8fafc;
  flex-shrink: 0;
}

/* ── Editor layout (two-column inside modal) ────────────────────────────── */
.mc-modal-editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) 310px;
  gap: 24px;
  align-items: start;
}

.mc-modal-editor-main { min-width: 0; }

.mc-modal-editor-preview {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--mc-line);
  border-radius: 18px;
  background: linear-gradient(160deg, #f8fafc, #eff6ff);
  position: sticky;
  top: 0;
}


/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 1400px) {
  .mc-kpi-grid,
  .mc-kpi-grid--compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .mc-project-topbar .title small { display: none; }
  .mc-project-topbar select { min-width: 120px; font-size: 13px; }
  .mc-project-topbar .user-badge { max-width: 160px; font-size: 12px; }
}

@media (max-width: 1100px) {
  .mc-kpi-strip     { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mc-summary-grid  { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .mc-modal-editor-layout { grid-template-columns: 1fr; }
  .mc-modal--xl           { max-width: calc(100vw - 32px); }
}

@media (max-width: 960px) {
  .mc-container { padding: 0 16px; }

  .mc-project-topbar .inner { gap: 8px; }
  .mc-project-topbar .right { gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
  .mc-project-topbar select { min-width: 100px; padding: 6px 8px; }

  .mc-page-hd              { padding: 18px 0 14px; flex-direction: column; align-items: stretch; }
  .mc-page-hd-right        { justify-content: flex-start; }

  .mc-action-bar           { flex-direction: column; align-items: stretch; }
  .mc-action-bar-btns      { justify-content: flex-start; }

  .mc-cost-summary-grid,
  .mc-checklist-grid        { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .mc-form-grid--2col,
  .mc-form-grid--3col,
  .mc-form-grid--4col,
  .mc-field-row,
  .mc-chart-grid,
  .mc-preview-stats,
  .mc-kpi-grid--compact     { grid-template-columns: 1fr; }

  .mc-section-heading,
  .mc-subsection-heading    { flex-direction: column; align-items: stretch; }

  .mc-source-item           { grid-template-columns: 1fr; }
  .mc-panel                 { padding: 18px; }
}

@media (max-width: 720px) {
  .mc-project-topbar .inner,
  .mc-project-topbar .right   { flex-wrap: wrap; }
  .mc-project-topbar .brand img { height: 48px; }

  .mc-kpi-strip,
  .mc-cost-summary-grid,
  .mc-kpi-grid,
  .mc-kpi-grid--compact,
  .mc-summary-grid,
  .mc-checklist-grid          { grid-template-columns: 1fr; }

  .mc-risk-mitigation-box,
  .risk-mitigation-box,
  .mc-bar-row                 { grid-template-columns: 1fr; }
  .mc-bar-row strong          { text-align: left; }

  .mc-modal,
  .mc-modal--xl {
    max-width: calc(100vw - 16px);
    max-height: 94vh;
    border-radius: 20px;
  }

  .mc-modal-hd  { padding: 18px 20px 14px; }
  .mc-modal-body { padding: 16px 20px; }
  .mc-modal-ft  { padding: 14px 20px; flex-wrap: wrap; }
}

@media (max-width: 640px) {
  .mc-test-summary     { grid-template-columns: repeat(2, 1fr); }
  .mc-integrated-fields { grid-template-columns: 1fr; }
}

/* ── Portfolio narrow ───────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .report-kpi-grid        { grid-template-columns: 1fr 1fr; }
  .portfolio-matrix-grid  { min-height: 200px; }
  .mc-bar-row             { grid-template-columns: minmax(60px, 120px) 1fr 60px 40px; }
}

@media (max-width: 640px) {
  .report-kpi-grid { grid-template-columns: 1fr; }
}

/* ── Print ──────────────────────────────────────────────────────────────── */
@media print {
  body * { visibility: hidden; }

  #printableExecutiveReport,
  #printableExecutiveReport * { visibility: visible; }

  #printableExecutiveReport {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    padding: 24px;
  }

  .nav, .sidebar, .mc-tabs-nav, .mc-panel-actions, button { display: none !important; }

  .report-cover { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .report-section { page-break-inside: avoid; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   PERCENTILE PICKER
   ═══════════════════════════════════════════════════════════════════════════ */

.mc-percentile-picker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--mc-slate-50, #f8fafc);
  border: 1px solid var(--mc-line, #e2e8f0);
  border-radius: 10px;
  margin-bottom: 16px;
}

.mc-field-label {
  font-size: 11px;
  font-weight: 800;
  color: var(--mc-slate-500, #64748b);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  white-space: nowrap;
}

.mc-checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
  color: var(--mc-slate-700, #334155);
  cursor: pointer;
  user-select: none;
}

.mc-checkbox-inline input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--mc-blue, #2563eb);
  cursor: pointer;
}
