/* =========================
   Design Tokens (Your Palette)
   ========================= */
:root {
  /* Brand */
  --brand-900: #172654;
  --brand-700: #1e42ac;

  /* Backgrounds / Surfaces */
  --bg-0: #ffffff;
  --bg-100: #ebecf0;

  /* Accent tints */
  --tint-blue: #c3cfef;
  --tint-violet: #cec2ef;
  --tint-pink: #e5c3f0;

  /* Neutrals */
  --ink-950: #171717;
  --ink-900: #1a1a1a;
  --ink-800: #333333;
  --ink-700: #4d4d4d;
  --ink-600: #666666;
  --ink-500: #7f7f7f;

  --border-300: #cccccc;
  --border-200: #e6e6e6;
  --border-100: #f2f2f2;

  /* Status Colors (UI-only; not from palette but standard) */
  --red: #ef4444;
  --orange: #f97316;
  --yellow: #f59e0b;
  --green: #22c55e;
  --blue: #2d2af0;

  /* Layout */
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.07);
  --shadow-2: 0 10px 26px rgba(0, 0, 0, 0.14);

  /* Typography */
  --font-sans: "Geist", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

/* Optional: if you have Geist woff2 locally, add @font-face here
@font-face {
  font-family: "Geist";
  src: url("./assets/fonts/Geist-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
}
*/

/* =========================
   Base
   ========================= */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--ink-900);
  background: var(--bg-100);
}

button, input { font: inherit; }

.card {
  background: var(--bg-0);
  border: 1px solid var(--border-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--ink-700);
  cursor: pointer;
}
.icon-btn:hover {
  background: rgba(30, 66, 172, 0.06);
  color: var(--brand-700);
}
.icon-btn--small { width: 34px; height: 34px; border-radius: 10px; }

/* =========================
   App Layout
   ========================= */
.app-shell {
  height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr 360px;
  gap: 0;
  /* Smoothly animate when the assistant panel collapses/expands */
  transition: grid-template-columns 0.3s ease;
}

/* Collapsed state — assistant panel hidden, main expands */
.app-shell.assistant-collapsed {
  grid-template-columns: 280px 1fr 0;
}
.app-shell.assistant-collapsed .assistant {
  overflow: hidden;
  pointer-events: none;
  visibility: hidden;
  transition: visibility 0s 0.3s; /* hide visibility only after transition completes */
}

/* =========================
   Sidebar
   ========================= */
.sidebar {
  background: var(--bg-0);
  border-right: 1px solid var(--border-200);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sidebar__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-mark__logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand-700), var(--brand-900));
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
}

.brand-mark {
  display: flex;
  align-items: center;
  min-width: 0;
}

.brand-mark__link {
  display: flex;
  align-items: center;
  text-decoration: none;
  min-width: 0;
}

.brand-mark__img {
  height: 32px;        /* תוכל לשנות ל-24/32 לפי הטעם */
  width: auto;
  max-width: 170px;    /* מגביל שלא יגלוש לכפתור ה-menu */
  object-fit: contain;
  display: block;
}

.primary-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  border: 0;
  height: 42px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand-700), #2f8cff);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(30, 66, 172, 0.22);
}
.primary-pill:hover { filter: brightness(0.98); }

.sidebar__section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar__label {
  font-size: 12px;
  letter-spacing: 0.03em;
  color: var(--ink-500);
  font-weight: 700;
  margin-top: 6px;
}

.session-item {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 10px;
  padding: 10px;
  border-radius: 14px;
  text-decoration: none;
  color: inherit;
  border: 1px solid transparent;
}
.session-item:hover {
  background: rgba(30, 66, 172, 0.04);
  border-color: rgba(30, 66, 172, 0.10);
}
.session-item--active {
  background: rgba(30, 66, 172, 0.06);
  border-color: rgba(30, 66, 172, 0.18);
}
.session-item__icon {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #fff;
}
.session-item__icon--blue { background: var(--brand-700); }
.session-item__icon--orange { background: var(--orange); }
.session-item__icon--teal { background: #06b6d4; }
.session-item__icon--violet { background: #8b5cf6; }
.session-item__icon--red { background: var(--red); }

.session-item__title { font-weight: 700; font-size: 14px; }
.session-item__meta { font-size: 12px; color: var(--ink-600); margin-top: 2px; }

.ghost-action {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 10px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-700);
  cursor: pointer;
  justify-content: flex-start;
}
.ghost-action:hover {
  background: rgba(30, 66, 172, 0.04);
  border-color: rgba(30, 66, 172, 0.10);
  color: var(--brand-700);
}

.sidebar__footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border-200);
}

.user-chip {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--border-200);
  border-radius: 16px;
}
.user-chip__avatar {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  background: rgba(30, 66, 172, 0.10);
  display: grid;
  place-items: center;
  font-weight: 800;
  color: var(--brand-700);
}
.user-chip__name { font-weight: 800; font-size: 14px; }
.user-chip__role { font-size: 12px; color: var(--ink-600); }

/* =========================
   Main
   ========================= */
.main {
  display: grid;
  grid-template-rows: 64px 1fr;
  min-width: 0;
}

.topbar {
  background: var(--bg-0);
  border-bottom: 1px solid var(--border-200);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar__left { display: flex; align-items: center; gap: 14px; }
.topbar__title { display: flex; gap: 10px; align-items: baseline; }
.topbar__brand { font-weight: 900; letter-spacing: 0.02em; }
.topbar__sub { color: var(--brand-700); font-weight: 700; font-size: 13px; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border-200);
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--bg-0);
  color: var(--ink-700);
  font-size: 12px;
  font-weight: 600;
}
.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
}
.status-dot--small { width: 8px; height: 8px; box-shadow: 0 0 0 3px rgba(34,197,94,0.14); }

.topbar__right { display: flex; align-items: center; gap: 6px; }

/* =========================
   Map Canvas
   ========================= */
.canvas {
  position: relative;
  min-width: 0;
  overflow: hidden;
  background: #0b1a2a; /* fallback behind map */
}

.map {
  position: absolute;
  inset: 0;
}

/* Overlays */
.overlay {
  position: absolute;
  z-index: 5;
}

.overlay--scenario {
  top: 18px;
  left: 18px;
  width: 320px;
  padding: 14px;
}

.card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}
.card__title { font-weight: 900; }
.card__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  margin-top: 8px;
  width: fit-content;
}
.card__badge--critical {
  background: rgba(239, 68, 68, 0.12);
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.scenario-row {
  margin-top: 10px;
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--ink-800);
  font-weight: 600;
}
.scenario-row svg { width: 18px; height: 18px; color: var(--brand-700); }

.overlay--health {
  top: 18px;
  right: 18px;
  width: 200px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.metric {
  padding: 10px 12px;
  border-radius: 14px;
}
.metric__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.metric__label { font-size: 12px; color: var(--ink-700); font-weight: 800; }
.metric__value { font-size: 12px; font-weight: 900; }
.metric__value--red { color: var(--red); }
.metric__value--orange { color: var(--orange); }
.metric__value--yellow { color: var(--yellow); }
.metric__value--green { color: var(--green); }
.metric__value--blue { color: var(--blue); }
.bar {
  margin-top: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--border-100);
  overflow: hidden;
}
.bar__fill { height: 100%; border-radius: 999px; }
.bar__fill--red { background: var(--red); }
.bar__fill--orange { background: var(--orange); }
.bar__fill--yellow { background: var(--yellow); }
.bar__fill--green { background: var(--green); }
.bar__fill--blue { background: var(--blue); }

/* =====================================================
   Recommendations panels (right of Active Scenario)
   ===================================================== */
.recommendations-panel.is-hidden { display: none !important; }

.recommendations-panel {
  position: absolute;
  top: 18px;
  left: 354px; /* fallback: 18 + 320 + 16 */
  z-index: 15;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 10px;
  pointer-events: auto;
  max-width: calc(100% - 390px);
}

.recommendations-panel__col {
  width: 280px;
  max-width: 36vw;
  background: rgba(15, 23, 42, 0.90);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(99, 102, 241, 0.35);
  border-radius: 12px;
  padding: 6px 0 4px;
  flex-shrink: 0;
}

.recommendations-panel__col--strategic {
  border-color: rgba(56, 189, 248, 0.40);
}

.recommendations-bar__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 12px 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: rgba(255, 255, 255, 0.45);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.recommendations-bar__list {
  list-style: none;
  margin: 0;
  padding: 2px 0;
  max-height: 220px;
  overflow-y: auto;
}

.rec-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  cursor: pointer;
  transition: background 0.12s;
}
.rec-item:hover,
.rec-item--active { background: rgba(255, 255, 255, 0.07); }

.rec-item--empty {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.35);
  cursor: default;
  padding: 8px 12px;
}
.rec-item--empty:hover { background: none; }

.rec-item__rank {
  font-size: 10px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.30);
  width: 14px;
  flex-shrink: 0;
  text-align: right;
}

.rec-item__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.rec-item__dot--critical  { background: #DC2626; }
.rec-item__dot--high      { background: #F97316; }
.rec-item__dot--medium    { background: #EAB308; }
.rec-item__dot--strategic { background: #38BDF8; box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.25); }

.rec-item--strategic .rec-item__title { color: rgba(186, 230, 253, 0.95); font-weight: 600; }

.rec-item__title {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.85);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* =====================================================
   Recommendation popup — centered modal
   ===================================================== */
.recommendation-popup__backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(10, 16, 30, 0.55);
  backdrop-filter: blur(2px);
}
.recommendation-popup__backdrop.is-hidden { display: none !important; }

.recommendation-popup.is-hidden { display: none !important; }

.recommendation-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 100;
  width: min(440px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
  overflow-y: auto;
  background: rgba(10, 18, 36, 0.98);
  border: 1px solid rgba(99, 102, 241, 0.45);
  border-radius: 14px;
  padding: 18px 20px 20px;
  pointer-events: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
}

.recommendation-popup__close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.55);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.recommendation-popup__close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.recommendation-popup__header {
  margin-bottom: 12px;
  padding-right: 28px; /* leave room for close button */
}

.recommendation-popup__kind {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 7px;
  border-radius: 999px;
  margin-bottom: 8px;
}
.recommendation-popup__kind--tactical {
  color: #FCA5A5;
  background: rgba(220, 38, 38, 0.18);
  border: 1px solid rgba(220, 38, 38, 0.35);
}
.recommendation-popup__kind--strategic {
  color: #BAE6FD;
  background: rgba(56, 189, 248, 0.16);
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.recommendation-popup__title {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  line-height: 1.4;
}

.recommendation-popup__section-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.4);
  margin-bottom: 4px;
  margin-top: 10px;
}

.recommendation-popup__text {
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.6;
}

/* Timeline */
.timeline {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 16px;
  z-index: 5;
  padding: 12px 14px;
  border-radius: var(--radius-lg);
}
.timeline__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.timeline__title { font-weight: 900; }
.timeline__controls { display: flex; gap: 6px; }

.timeline__track {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 60px 1fr 60px;
  gap: 10px;
  align-items: center;
}
.timeline__t { font-size: 12px; color: var(--ink-600); font-weight: 700; }

.timeline__range {
  width: 100%;
  accent-color: var(--brand-700);
}

/* =========================
   Assistant Panel
   ========================= */
.assistant {
  background: var(--bg-0);
  border-left: 1px solid var(--border-200);
  display: grid;
  grid-template-rows: 68px 1fr 110px;
  min-width: 0;
}

.assistant__header {
  padding: 14px 14px;
  border-bottom: 1px solid var(--border-200);
  background: linear-gradient(90deg, rgba(30, 66, 172, 0.10), rgba(195, 207, 239, 0.35));
  position: relative; /* anchor for the close button */
}

/* Close (X) button inside the assistant header */
.assistant__close {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-700);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.15s, color 0.15s;
}
.assistant__close:hover {
  background: rgba(15, 23, 42, 0.08);
  color: var(--brand-700);
}
.assistant__close i { width: 18px; height: 18px; }

/* Floating handle on the right edge — visible only when collapsed */
.assistant-reopen-handle {
  display: none;
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 56px;
  border: 1px solid var(--border-200);
  border-right: 0;
  border-radius: 10px 0 0 10px;
  background: var(--bg-0);
  color: var(--brand-700);
  cursor: pointer;
  z-index: 60;
  align-items: center;
  justify-content: center;
  box-shadow: -4px 0 12px rgba(15, 23, 42, 0.08);
  transition: background 0.15s, transform 0.15s;
}
.assistant-reopen-handle:hover {
  background: rgba(30, 66, 172, 0.06);
  transform: translateY(-50%) translateX(-2px);
}
.assistant-reopen-handle i { width: 18px; height: 18px; }

.app-shell.assistant-collapsed .assistant-reopen-handle {
  display: flex;
}
.assistant__title {
  display: flex;
  align-items: center;
  gap: 10px;
}
.assistant__bot {
  width: 38px;
  height: 38px;
  border-radius: 14px;
  background: rgba(30, 66, 172, 0.12);
  display: grid;
  place-items: center;
  color: var(--brand-700);
}
.assistant__name { font-weight: 900; }
.assistant__status { font-size: 12px; color: var(--ink-700); display: flex; align-items: center; gap: 8px; }

.assistant__body {
  padding: 14px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: linear-gradient(180deg, rgba(235,236,240,0.55), rgba(255,255,255,1));
}

.chat-bubble {
  max-width: 92%;
  border-radius: 18px;
  padding: 12px 12px;
  box-shadow: var(--shadow-1);
  border: 1px solid var(--border-200);
}
.chat-bubble--bot {
  background: linear-gradient(180deg, rgba(30,66,172,0.10), rgba(30,66,172,0.06));
  align-self: flex-start;
}
.chat-bubble--user {
  background: rgba(255,255,255,1);
  align-self: flex-end;
}
.chat-bubble--progress {
  background: linear-gradient(180deg, rgba(30,66,172,0.12), rgba(195,207,239,0.20));
}

.chat-bubble__text {
  font-size: 13px;
  line-height: 1.35;
  color: var(--ink-900);
  font-weight: 600;
}
.chat-bubble__time {
  margin-top: 8px;
  font-size: 11px;
  color: var(--ink-600);
  font-weight: 700;
}

.quick-card {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.quick-btn {
  width: 100%;
  border: 1px solid rgba(30,66,172,0.14);
  background: rgba(30,66,172,0.06);
  color: var(--brand-900);
  border-radius: 12px;
  padding: 10px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}
.quick-btn:hover { background: rgba(30,66,172,0.10); }
.quick-btn svg { width: 18px; height: 18px; color: var(--brand-700); }

.progress-card {
  margin-top: 10px;
  background: rgba(255,255,255,0.7);
  border: 1px solid rgba(30,66,172,0.12);
  border-radius: 14px;
  padding: 10px;
}
.progress-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--ink-800);
  font-weight: 700;
  padding: 6px 0;
}
.progress-pill {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(30,66,172,0.10);
  color: var(--brand-700);
  border: 1px solid rgba(30,66,172,0.18);
}
.progress-ok { color: var(--green); }
.progress-wip { color: var(--brand-700); }

.assistant__composer {
  padding: 12px 14px;
  border-top: 1px solid var(--border-200);
  display: grid;
  grid-template-columns: 1fr 44px;
  gap: 10px;
  align-items: center;
  background: var(--bg-0);
}
.composer__input {
  height: 42px;
  border-radius: 14px;
  border: 1px solid var(--border-300);
  padding: 0 12px;
  outline: none;
}
.composer__input:focus {
  border-color: rgba(30,66,172,0.45);
  box-shadow: 0 0 0 4px rgba(195,207,239,0.55);
}

.composer__send {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  width: 44px;
  border: 0;
  border-radius: 14px;
  background: var(--brand-700);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(30,66,172,0.25);
}
.composer__send:hover { filter: brightness(0.98); }

.assistant__disclaimer {
  grid-column: 1 / -1;
  margin-top: 8px;
  font-size: 11px;
  color: var(--ink-600);
  font-weight: 700;
}

/* =========================
   Center Canvas – Paper background variant
   ========================= */
.canvas--paper {
  position: relative;
  background: var(--bg-100);
  overflow: auto;
}

/* =========================
   Simulation Config Screen
   ========================= */
.simcfg {
  padding: 22px 22px 28px;
  max-width: 1200px;
  margin: 0 auto;
}

.simcfg__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.simcfg__title {
  margin: 0;
  font-size: 28px;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--brand-900);
  font-weight: 900;
}

.simcfg__subtitle {
  margin: 6px 0 0;
  color: var(--ink-600);
  font-weight: 700;
  font-size: 13px;
}

.simcfg__chips {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(30, 66, 172, 0.14);
  background: rgba(30, 66, 172, 0.06);
  color: var(--brand-900);
  font-weight: 900;
  font-size: 12px;
}
.chip__label { color: var(--ink-700); font-weight: 800; }
.chip__value { color: var(--brand-700); }

.simcfg__card {
  padding: 0;
  overflow: hidden;
}

.simcfg__card-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-200);
  background: linear-gradient(90deg, rgba(30,66,172,0.08), rgba(195,207,239,0.20));
}

.simcfg__card-title {
  font-weight: 900;
  color: var(--brand-900);
}

.simcfg__grid {
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.field--span2 {
  grid-column: span 2;
}

.field__label {
  font-size: 12px;
  font-weight: 900;
  color: var(--ink-700);
}

.field__control {
  height: 42px;
  border-radius: 14px;
  border: 1px solid var(--border-300);
  background: var(--bg-0);
  padding: 0 12px;
  outline: none;
  color: var(--ink-900);
  font-weight: 700;
}

.field__control:focus {
  border-color: rgba(30,66,172,0.45);
  box-shadow: 0 0 0 4px rgba(195,207,239,0.55);
}

.simcfg__info {
  padding: 0 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.info-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border-200);
  background: rgba(255,255,255,0.85);
  color: var(--ink-800);
  font-weight: 700;
}

.info-row svg {
  width: 18px;
  height: 18px;
  color: var(--brand-700);
}

.simcfg__actions {
  padding: 14px 16px 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  border-top: 1px solid var(--border-200);
  background: rgba(255,255,255,0.85);
}

.btn {
  height: 44px;
  border-radius: 14px;
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 900;
}

.btn svg { width: 18px; height: 18px; }

.btn--primary {
  background: var(--brand-700);
  color: #fff;
  box-shadow: 0 10px 22px rgba(30,66,172,0.22);
}

.btn--primary:hover { filter: brightness(0.98); }

.btn--success {
  background: rgba(34,197,94,0.14);
  border-color: rgba(34,197,94,0.28);
  color: #0b4d2a;
}

.btn--success:hover { background: rgba(34,197,94,0.18); }

/* Desktop safeguards */
@media (max-width: 1200px) {
  .simcfg__grid { grid-template-columns: repeat(2, 1fr); }
  .field--span2 { grid-column: span 2; }
  .simcfg__actions { grid-template-columns: 1fr; }
}

/* =========================
   Dark canvas variant (Decision Support)
   ========================= */
.canvas--dark {
  background: radial-gradient(1200px 600px at 40% 20%, rgba(30,66,172,0.22), rgba(0,0,0,0.0)),
              linear-gradient(180deg, #0c1016, #070a10);
  color: #e8eefb;
  overflow: auto;
}

/* =========================
   Decision Support (prefix: ds)
   ========================= */
.ds {
  padding: 18px 18px 26px;
  max-width: 1400px;
  margin: 0 auto;
}

.ds__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 12px;
}

.ds__title {
  margin: 0;
  font-size: 28px;
  letter-spacing: -0.02em;
  font-weight: 900;
  color: #f3f6ff;
}

.ds__run {
  margin-top: 4px;
  font-size: 12px;
  color: rgba(242,242,242,0.72);
  font-weight: 700;
}

.ds__header-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.ds-btn {
  border-radius: 12px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(230,230,230,0.18);
  background: rgba(255,255,255,0.04);
  color: rgba(242,242,242,0.88);
  font-weight: 800;
  cursor: pointer;
}
.ds-btn:hover {
  background: rgba(255,255,255,0.07);
  border-color: rgba(195,207,239,0.25);
}
.ds-btn--chip {
  height: 34px;
  font-size: 12px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.ds-btn--ghost {
  background: rgba(255,255,255,0.03);
}

.ds__kpis {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 18px;
  margin-bottom: 14px;
}

.kpi-rail__top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}

.kpi-rail__label {
  font-size: 12px;
  font-weight: 900;
  color: rgba(242,242,242,0.85);
}

.kpi-rail__value {
  font-size: 12px;
  font-weight: 900;
  color: rgba(242,242,242,0.90);
}

.kpi-rail__meta {
  font-weight: 800;
  font-size: 11px;
  color: rgba(242,242,242,0.62);
  margin-left: 10px;
}

.rail {
  margin-top: 8px;
  height: 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.10);
}

.rail__fill {
  height: 100%;
  width: 50%;
  background: linear-gradient(90deg, #ef4444 0%, #f59e0b 35%, #22c55e 85%);
  border-radius: 999px;
}

/* Two main cards */
.ds__grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 14px;
}

.ds-card {
  border-radius: 16px;
  border: 1px solid rgba(230,230,230,0.14);
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
  box-shadow: 0 18px 40px rgba(0,0,0,0.35);
  overflow: hidden;
}

.ds-card__head {
  padding: 12px 12px;
  border-bottom: 1px solid rgba(230,230,230,0.12);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.ds-card__title {
  font-weight: 900;
  color: rgba(242,242,242,0.92);
}

.ds-card__tools {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ds-tabs {
  padding: 10px 12px 0;
  display: flex;
  gap: 8px;
}

.ds-tab {
  height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(230,230,230,0.14);
  background: rgba(255,255,255,0.03);
  color: rgba(242,242,242,0.82);
  font-weight: 900;
  font-size: 12px;
  cursor: pointer;
}
.ds-tab--active {
  border-color: rgba(195,207,239,0.35);
  background: rgba(30,66,172,0.18);
  color: rgba(242,242,242,0.92);
}

.ds-table-wrap {
  padding: 10px 12px 12px;
}
.ds-table-wrap--tight { padding-top: 12px; }

.ds-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  color: rgba(242,242,242,0.84);
}

.ds-table thead th {
  text-align: left;
  padding: 10px 10px;
  font-weight: 900;
  color: rgba(242,242,242,0.86);
  border-bottom: 1px solid rgba(230,230,230,0.14);
}

.ds-table tbody td {
  padding: 9px 10px;
  border-bottom: 1px solid rgba(230,230,230,0.10);
  vertical-align: top;
}

.ds-table tbody tr:hover {
  background: rgba(255,255,255,0.04);
}

.ds-table__total td {
  font-weight: 900;
  color: rgba(242,242,242,0.92);
}

.muted { color: rgba(242,242,242,0.62); }

.ds-card__footer {
  padding: 10px 12px 14px;
  border-top: 1px solid rgba(230,230,230,0.10);
  display: flex;
  justify-content: center;
}

.donut {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 10px;
  align-items: center;
}

.donut__canvas {
  width: 160px;
  height: 160px;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid rgba(230,230,230,0.12);
  background: rgba(255,255,255,0.03);
}

.donut__legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: rgba(242,242,242,0.80);
  font-weight: 800;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--brand-700);
  display: inline-block;
  margin-right: 8px;
}

.donut__note {
  font-size: 12px;
  color: rgba(242,242,242,0.62);
}

.ds-metrics {
  padding: 0 12px 12px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.ds-metric {
  border-radius: 14px;
  border: 1px solid rgba(230,230,230,0.12);
  background: rgba(255,255,255,0.03);
  padding: 10px;
}

.ds-metric__label {
  font-size: 11px;
  color: rgba(242,242,242,0.62);
  font-weight: 900;
}

.ds-metric__value {
  margin-top: 4px;
  font-size: 16px;
  font-weight: 900;
  color: rgba(242,242,242,0.92);
}

.ds-metric__sub {
  margin-top: 2px;
  font-size: 11px;
  font-weight: 800;
  color: rgba(242,242,242,0.60);
}

.ds-chart {
  padding: 0 12px 14px;
}

#map {
  width: 100%;
  height: 100%;
  position: relative;
}

/* ===== Chat "thinking" state ===== */
.is-thinking .composer__input {
  opacity: 0.7;
  pointer-events: none;
}

.is-thinking .composer__send {
  opacity: 0.6;
  pointer-events: none;
}

.thinking-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.25);
  border-top-color: rgba(255,255,255,0.9);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}



@keyframes spin {
  to { transform: rotate(360deg); }
}

/* =========================
   Freeze header + sidebar (no page scroll)
   ========================= */
html, body {
  height: 100%;
  overflow: hidden; /* prevents the whole page from scrolling */
}

.app-shell{
  height: 100vh;
  overflow: hidden; /* keep scroll inside panels only */
}

/* Grid children must allow internal scroll (critical in CSS Grid) */
.sidebar,
.main,
.assistant{
  min-height: 0;
}

/* Sidebar: stays in place, scrolls internally if needed */
.sidebar{
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
}

/* Main column should not create page scroll */
.main{
  overflow: hidden;
}

/* Keep the top bar visible (extra safety) */
.topbar{
  position: sticky;
  top: 0;
  z-index: 50;
}

/* Assistant: internal scroll only */
.assistant{
  overflow: hidden;
}

.assistant__body{
  min-height: 0;
  overflow: auto;
}


.impact-timeline.is-hidden {
  display: none !important;
}


/* Responsive guard (still desktop-first) */
@media (max-width: 1200px) {
  .ds__grid { grid-template-columns: 1fr; }
  .ds__kpis { grid-template-columns: 1fr; }
  .ds-metrics { grid-template-columns: repeat(2, 1fr); }
}


.bar__fill {
  height: 100%;
  border-radius: 999px;
  background: #999; /* overridden by JS */
}

/* Start hidden */
#activeScenarioCard,
#healthOverlay {
  display: none;
}

/* Explicit “shown” states (JS will add these classes) */
#activeScenarioCard.is-visible,
#healthOverlay.is-visible {
  display: block;
}


/* =========================
   Simulation Config Modal
   ========================= */
.sim-overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
}

.sim-overlay.is-hidden {
  display: none;
}

.sim-modal {
  width: min(980px, calc(100% - 56px));
  background: #f7f8fb;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(2, 6, 23, 0.25);
  padding: 22px;
}

.sim-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.sim-modal__title {
  font-size: 26px;
  font-weight: 900;
  color: #0f172a;
}

.sim-modal__subtitle {
  font-size: 13px;
  color: #475569;
  margin-top: 2px;
}

.sim-pills {
  display: flex;
  gap: 10px;
}

.sim-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 999px;
  background: #eef2ff;
  border: 1px solid rgba(30, 66, 172, 0.18);
  color: #0f172a;
  font-size: 12px;
  font-weight: 700;
}

.sim-pill b {
  font-size: 14px;
}

.sim-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding-top: 10px;
}

.sim-field { display: flex; flex-direction: column; gap: 8px; }
.sim-field--wide { grid-column: 1 / -1; }

.sim-label { font-size: 12px; font-weight: 800; color: #334155; }

.sim-input {
  height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.14);
  background: #ffffff;
  padding: 0 12px;
  font-weight: 700;
  outline: none;
}

.sim-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.sim-btn {
  height: 44px;
  border-radius: 12px;
  padding: 0 16px;
  font-weight: 900;
  cursor: pointer;
  border: 1px solid transparent;
}

.sim-btn--ghost {
  background: #ffffff;
  border-color: rgba(15, 23, 42, 0.14);
  color: #0f172a;
}

.sim-btn--primary {
  background: #1e42ac;
  color: #ffffff;
}
/* =========================
   Landscape Pill (Topbar)
   ========================= */
.landscape-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.14);
  background: #ffffff;
  color: #0f172a;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.12s ease;
}

.landscape-pill:hover {
  box-shadow: 0 10px 25px rgba(2, 6, 23, 0.12);
  transform: translateY(-1px);
}

.landscape-pill__label {
  font-size: 12px;
  opacity: 0.75;
  font-weight: 800;
}

#activeLandscapeName {
  font-size: 12px;
}

/* =========================
   Landscape Modal
   ========================= */
.ls-modal {
  width: min(980px, calc(100% - 56px));
  background: #f7f8fb;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(2, 6, 23, 0.25);
  padding: 22px;
}

.ls-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.ls-modal__title {
  font-size: 26px;
  font-weight: 900;
  color: #0f172a;
}

.ls-modal__subtitle {
  font-size: 13px;
  color: #475569;
  margin-top: 2px;
}

.ls-toolbar {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  margin-top: 10px;
}

.ls-body {
  margin-top: 12px;
  max-height: min(52vh, 520px);
  overflow: auto;
  padding-right: 6px;
}

.ls-list {
  display: grid;
  gap: 10px;
}

.ls-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: #ffffff;
  cursor: pointer;
}

.ls-item.is-selected {
  border-color: rgba(30, 66, 172, 0.45);
  box-shadow: 0 14px 30px rgba(30, 66, 172, 0.12);
}

.ls-item__name {
  font-weight: 900;
  color: #0f172a;
}

.ls-item__meta {
  font-size: 12px;
  color: #475569;
  margin-top: 4px;
  font-weight: 700;
}

.ls-item__badge {
  font-size: 11px;
  font-weight: 900;
  padding: 7px 10px;
  border-radius: 999px;
  background: #eef2ff;
  border: 1px solid rgba(30, 66, 172, 0.18);
  color: #0f172a;
  white-space: nowrap;
}

.ls-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

/* When modal is open - disable map interactions */
.canvas.map-disabled #map {
  pointer-events: none;
  filter: grayscale(0.1) contrast(0.95);
}

/* =========================
   Dependencies Overlay
   ========================= */
.deps-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
}

.deps-overlay.is-hidden {
  display: none;
}

.deps-modal {
  width: min(1100px, calc(100% - 64px));
  height: min(700px, calc(100% - 64px));
  background: #f7f8fb;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(2, 6, 23, 0.25);
  display: flex;
  flex-direction: column;
  max-height: 78vh;           /* critical: constrain height */
  display: flex;              /* critical */
  flex-direction: column;     /* critical */
  overflow: hidden; 
}

.deps-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-200);
  flex: 0 0 auto;
}

.deps-modal__title {
  font-size: 18px;
  font-weight: 900;
  color: var(--brand-900);
}

.deps-modal__body {
  /*flex: 1;*/
  flex: 1 1 auto;
  min-height: 0;     /* CRITICAL for flex scrolling */
  overflow: auto;    /* CRITICAL */
  -webkit-overflow-scrolling: touch;
  padding: 14px;
  display: flex;
}

.deps-graph-placeholder {
  flex: 1;
  border-radius: 14px;
  border: 2px dashed rgba(30, 66, 172, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-600);
  font-weight: 800;
  font-size: 14px;
}

/* 3D graph canvas */
#depsGraphMount canvas {
  width: 100% !important;
  height: 100% !important;
  border-radius: 12px;
}


/* Make the dependencies modal body give the graph a real canvas area */
#dependenciesOverlay .deps-modal {
  width: min(1400px, 96vw);
  height: min(900px, 92vh);
}

#dependenciesOverlay .deps-modal__body {
  height: calc(100% - 56px); /* header ~56px */
}

#depsGraphMount {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  border-radius: 12px;
}

/* ===== Dependencies: split layout (side panel + graph) ===== */
.deps-layout{
  display:flex;
  gap:12px;
  width:100%;
  height:100%;
  min-height:0;
}

.deps-side{
  width: 360px;
  max-width: 42%;
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.10);
  border-radius: 14px;
  padding: 12px;
  display:flex;
  flex-direction:column;
  min-height:0;
}

.deps-side__header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom:10px;
}

.deps-side__title{
  font-weight:600;
  color:#0f172a;
}

.deps-selected-meta{
  padding:10px;
  border-radius:12px;
  background:#f7f8fb;
  border: 1px solid rgba(15, 23, 42, 0.06);
  margin-bottom:10px;
}

.deps-selected-meta__name{
  font-weight:700;
  color:#0f172a;
  margin-bottom:4px;
}

.deps-selected-meta__sub{
  font-size:12px;
  color:#64748b;
}

.deps-cols{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:10px;
  min-height:0;
  overflow:hidden;
  flex:1;
}

.deps-col{
  min-height:0;
  display:flex;
  flex-direction:column;
}

.deps-col__title{
  font-size:12px;
  font-weight:700;
  color:#334155;
  margin: 4px 0 8px;
}

.deps-list{
  list-style:none;
  padding:0;
  margin:0;
  overflow:auto;
  min-height:0;
  border-top: 1px solid rgba(15, 23, 42, 0.06);
  padding-top:8px;
}

.deps-list li{
  padding:6px 6px;
  border-radius:10px;
  cursor:default;
  font-size:13px;
  color:#0f172a;
}

.deps-list li:hover{
  background:#f1f5f9;
}

.deps-graph-wrap{
  flex:1;
  min-width: 0;
  min-height: 0;
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, 0.10);
  background:#ffffff;
  overflow:hidden;
}

.deps-graph-mount{
  width:100%;
  height:100%;
}
.deps-depth {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
}

.deps-depth__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.deps-depth__label {
  font-size: 12px;
  color: #475569;
  font-weight: 600;
}

.deps-depth__val {
  font-size: 12px;
  color: #0f172a;
  font-weight: 700;
}

.deps-depth__slider {
  width: 100%;
}

.deps-depth__hint {
  margin-top: 6px;
  font-size: 11px;
  color: #64748b;
}

.msg {
  white-space: pre-wrap;
}

/* ============================================================
   Simulation Run Banner (top-center over the map)
   ============================================================ */
.sim-run-banner {
  position: absolute;
  left: 50%;
  top: 14px;
  transform: translateX(-50%);
  z-index: 5;
  width: min(980px, calc(100% - 32px));
  pointer-events: none;
}

.sim-run-banner__row {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(15, 23, 42, 0.10);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(2, 6, 23, 0.12);
  backdrop-filter: blur(10px);
}

.sim-run-banner__title {
  font-weight: 900;
  letter-spacing: 0.2px;
  color: #0f172a;
  font-size: 12px;
  text-transform: uppercase;
}

.sim-run-banner__meta {
  font-size: 12px;
  color: rgba(15, 23, 42, 0.72);
  font-weight: 700;
}

.sim-run-banner__right {
  flex: 1;
  text-align: right;
  font-size: 12px;
  font-weight: 800;
  color: rgba(15, 23, 42, 0.90);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================================
   Simulation Results Modal
   ============================================================ */

.results-modal__content{
  width: 100%;
  height: 100%;
  padding: 18px;
  overflow: auto;
}

.results-section{
  margin-bottom: 14px;
  border: 1px solid rgba(15, 23, 42, 0.10);
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
}

.results-section__toggle{
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 0;
  background: #f8fafc;
  cursor: pointer;
  text-align: left;
}

.results-section__toggle:hover{
  background: #f1f5f9;
}

.results-section__chevron{
  width: 8px;
  height: 8px;
  border-right: 2px solid #64748b;
  border-bottom: 2px solid #64748b;
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
  flex-shrink: 0;
  margin-left: 2px;
}

.results-section.is-open .results-section__chevron{
  transform: rotate(45deg);
  margin-top: -2px;
}

.results-section__title{
  flex: 1;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #334155;
}

.results-section__count{
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
  color: #334155;
  font-size: 12px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.results-section__body{
  padding: 12px 14px 14px;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
}

.results-section__body[hidden]{
  display: none !important;
}

.results-grid{
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.results-item{
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.10);
  border-radius: 14px;
  padding: 14px 14px;
}

.results-item--strategic{
  border-color: rgba(14, 165, 233, 0.35);
  background: #f8fcff;
}

.results-item--resilience{
  border-color: rgba(16, 185, 129, 0.35);
  background: #f6fdf9;
}

.results-item--empty{
  color: rgba(15, 23, 42, 0.55);
  font-size: 13px;
}

.results-item__head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
  margin-bottom: 8px;
}

.results-item__title{
  font-weight: 900;
  color: #0f172a;
}

.results-item__impact{
  font-weight: 800;
  color: #1e40af;
  font-size: 13px;
}

.results-item__body{
  color: rgba(15, 23, 42, 0.86);
  line-height: 1.35;
  font-size: 14px;
}

.results-item__meta{
  margin-top: 10px;
  font-size: 12px;
  color: rgba(15, 23, 42, 0.62);
}

.login-wrap { display:flex; height:100%; align-items:center; justify-content:center; }
.login-card { width:360px; padding:20px; border:1px solid #e5e7eb; border-radius:12px; background:#fff; }
.login-card label { display:block; margin-top:10px; font-size:12px; color:#334155; }
.login-card input { width:100%; padding:10px; margin-top:6px; border:1px solid #cbd5e1; border-radius:8px; }
.login-card button { width:100%; margin-top:14px; padding:10px; border-radius:8px; border:0; cursor:pointer; }
.login-error { margin-top:10px; color:#b91c1c; font-size:12px; }

body.edit-mode #btnEditMode {
  border: 1px solid var(--brand-700, #1e42ac);
  font-weight: 600;
}

body.edit-mode .mapboxgl-canvas {
  cursor: crosshair;
}


.icon-btn.active {
  outline: 2px solid var(--brand-700, #1e42ac);
  background: rgba(30, 66, 172, 0.08);
}

/* =========================
   A-6.2 Edit toolbar
   ========================= */
.editbar{
  display:flex;
  gap:10px;
  align-items:center;
}

body.edit-mode #btnEditMode{
  outline: 2px solid rgba(30,66,172,0.35);
}

#btnEditAdd.active,
#btnEditConnect.active{
  border-color: rgba(30,66,172,0.55);
  box-shadow: 0 0 0 2px rgba(30,66,172,0.15) inset;
}


/* =========================
   Connect (Edit) Modal
   ========================= */
.connect-modal {
  width: 540px;
  max-width: 92vw;
}

.connect-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.connect-assetbox {
  border: 1px solid var(--border-200);
  background: #fafafa;
  border-radius: 12px;
  padding: 10px;
}

.connect-label {
  font-size: 12px;
  color: var(--ink-600);
  margin-bottom: 2px;
}

.connect-name {
  font-weight: 800;
  font-size: 14px;
  color: var(--ink-900);
}

.connect-sector {
  font-size: 12px;
  color: var(--ink-700);
  margin-top: 4px;
}


.connect-id {
  font-size: 11px;
  color: var(--ink-600);
  margin-top: 2px;
  word-break: break-all;
}

.connect-radio {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.connect-radio__item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid var(--border-200);
  border-radius: 12px;
  padding: 10px;
  background: #fff;
  cursor: pointer;
}

.connect-radio__item input {
  margin-top: 3px;
}

.connect-radio__title {
  font-weight: 800;
  font-size: 13px;
}

.connect-radio__sub {
  font-size: 12px;
  color: var(--ink-600);
  margin-top: 2px;
}

.fake-btn svg {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
}

.connect-radio-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-900);
}

.connect-radio-title strong {
  font-weight: 800;
}


/* Orphans modal */
.orphans-help {
  color: var(--ink-700);
  font-size: 13px;
  margin-bottom: 10px;
}

.orphans-list {
  display: grid;
  gap: 8px;
  max-height: 46vh;
  overflow: auto;
  padding-right: 6px;
}

.orphan-row {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border-200);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
}

.orphan-row__meta {
  display: grid;
  gap: 2px;
  flex: 1;
}

.orphan-row__id {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  color: var(--ink-600);
}

/* =========================
   Asset Assign (Edit) Modal
   ========================= */
.asset-assign-modal {
  width: 560px;
  max-width: 92vw;
}

.asset-assign-body {
  margin-top: 12px;
}

.asset-assign-meta {
  display: flex;
  gap: 10px;
  align-items: baseline;
  margin-bottom: 12px;
}

.asset-assign-label {
  font-size: 12px;
  color: var(--ink-600);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.2px;
}

.asset-assign-id {
  font-size: 12px;
  color: var(--ink-700);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  word-break: break-all;
}

.asset-assign-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-field {
  display: grid;
  gap: 6px;
}

.form-field__label {
  font-size: 12px;
  font-weight: 800;
  color: var(--ink-700);
}

.form-field__input {
  width: 100%;
  padding: 10px 10px;
  border: 1px solid var(--border-200);
  border-radius: 10px;
  background: #fff;
  font-size: 13px;
  color: var(--ink-900);
}

.asset-assign-hint {
  margin-top: 10px;
  font-size: 12px;
  color: var(--ink-600);
  line-height: 1.35;
}

.asset-preview-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-900);
  line-height: 1.2;
}

.asset-preview-sub {
  font-size: 12px;
  color: var(--ink-600);
  margin-top: 4px;
  line-height: 1.2;
}
.asset-assign-modal {
  width: 760px;
  max-width: 95vw;
}

/* DB sync lock */
body.db-sync-lock .canvas {
  pointer-events: none;
}

body.db-sync-lock .composer__input,
body.db-sync-lock .composer__send,
body.db-sync-lock button,
body.db-sync-lock input,
body.db-sync-lock select {
  cursor: not-allowed;
}

/* =========================
   Asset Action Fan (Edit Mode)
   ========================= */
.asset-fan{
  position:absolute;
  z-index: 50;
  display:flex;
  flex-direction:column;
  gap:8px;
  padding:10px;
  border-radius:14px;
  border:1px solid rgba(15,23,42,0.14);
  background: rgba(255,255,255,0.96);
  box-shadow: 0 18px 40px rgba(15,23,42,0.18);
  backdrop-filter: blur(8px);
  min-width: 160px;
}


/* =========================
   Asset Action Fan (Edit Mode)
   ========================= */
.asset-fan{
  position:absolute;
  z-index: 60;
  display:flex;
  flex-direction:column;
  gap:8px;
  padding:10px;
  border-radius:14px;
  border:1px solid rgba(15,23,42,0.14);
  background: rgba(255,255,255,0.96);
  box-shadow: 0 18px 40px rgba(15,23,42,0.18);
  backdrop-filter: blur(8px);
  min-width: 160px;
}
.asset-fan.is-hidden{ display:none; }

.asset-fan__btn{
  display:flex;
  align-items:center;
  gap:10px;
  width:100%;
  padding:10px 10px;
  border-radius:12px;
  border:1px solid rgba(15,23,42,0.10);
  background:#fff;
  cursor:pointer;
  font-weight:800;
  color:#0f172a;
}
.asset-fan__btn:hover{
  background: rgba(30,66,172,0.06);
  border-color: rgba(30,66,172,0.22);
}
.asset-fan__btn svg{ width:16px; height:16px; flex:0 0 16px; }

.asset-fan__btn--danger{ color:#991b1b; }
.asset-fan__btn--danger:hover{
  background: rgba(185,28,28,0.08);
  border-color: rgba(185,28,28,0.22);
}

/* =========================
   Delete Asset Modal
   ========================= */
.delete-modal{
  width: 560px;
  max-width: 92vw;
}
.delete-body{
  padding: 14px 18px 2px 18px;
}
.delete-warning{
  border: 1px solid rgba(185,28,28,0.25);
  background: rgba(185,28,28,0.06);
  border-radius: 12px;
  padding: 12px;
}
.delete-warning__title{
  font-weight: 800;
  font-size: 13px;
  color: #7f1d1d;
  margin-bottom: 6px;
}
.delete-asset-name{
  font-weight: 900;
  font-size: 15px;
  color: #0f172a;
}
.delete-asset-id{
  font-size: 12px;
  color: #334155;
  margin-top: 2px;
  word-break: break-all;
}
.delete-meta{
  margin-top: 12px;
  border: 1px solid var(--border-200);
  background: #fff;
  border-radius: 12px;
  padding: 10px 12px;
}
.delete-meta__row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  font-size: 13px;
}
.delete-meta__hint{
  margin-top: 8px;
  font-size: 12px;
  color: var(--ink-600);
  line-height: 1.35;
}
.sim-btn--danger{
  background: #b91c1c;
  color: #fff;
}
.sim-btn--danger:hover{
  filter: brightness(0.95);
}

/* =====================================================
   Intervention / Recovery Planning overlay
   ===================================================== */
.timeline__header{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.timeline__controls{ display:flex; align-items:center; gap:6px; margin-left:auto; }
.timeline__intervene-btn{
  display:inline-flex;
  align-items:center;
  gap:6px;
  margin-right:4px;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid rgba(37,99,235,0.35);
  background:rgba(37,99,235,0.10);
  color:#1d4ed8;
  font-size:12px;
  font-weight:800;
  cursor:pointer;
  white-space:nowrap;
}
.timeline__intervene-btn:hover{
  background:rgba(37,99,235,0.18);
}
.timeline__intervene-btn svg{
  width:14px;
  height:14px;
}
.timeline__badge{
  font-size:11px; font-weight:800; padding:4px 10px; border-radius:999px;
  background: rgba(14,165,233,0.15); color:#0369a1; border:1px solid rgba(14,165,233,0.35);
}
.timeline__badge.is-hidden{ display:none !important; }

/* Intervention modal: taller than default deps-modal so Apply stays visible */
#interventionOverlay .iv-modal.deps-modal,
.iv-modal{
  width:min(1220px, 98vw);
  height:min(900px, 94vh);
  max-height:94vh;
  display:flex;
  flex-direction:column;
}
#interventionOverlay .deps-modal__body{
  flex:1;
  min-height:0;
  overflow:hidden;
  display:flex;
  flex-direction:column;
  padding:0;
}
.iv-mount{
  padding:10px 14px 0;
  flex:1;
  min-height:0;
  overflow:hidden;
  display:flex;
  flex-direction:column;
}
.iv-layout{
  display:grid;
  grid-template-columns: 1.35fr 1fr;
  gap:14px;
  flex:1;
  min-height:0;
  align-items:stretch;
}
.iv-col{
  min-height:0;
  display:flex;
  flex-direction:column;
}
.iv-col--impact{
  overflow:auto;
  padding-right:4px;
}
.iv-col--list .iv-repair-list{
  flex:1;
  min-height:0;
  max-height:none;
  overflow:auto;
}
.iv-actions{
  display:flex;
  justify-content:flex-end;
  gap:10px;
  flex:0 0 auto;
  margin-top:auto;
  padding:12px 2px 6px;
  border-top:1px solid #e2e8f0;
  background:#fff;
  position:relative;
  z-index:2;
}
.iv-subview{
  flex:1;
  min-height:0;
  height:100%;
  display:flex;
  flex-direction:column;
}
.iv-subview__scroll{
  flex:1;
  min-height:0;
  overflow:auto;
  padding-right:2px;
}
.iv-repair--dragging,
.iv-repair--placeholder{
  opacity:0.35;
  background:#e2e8f0;
  border-style:dashed;
  box-shadow:none;
  color:transparent;
}
.iv-repair--placeholder *{
  visibility:hidden;
}
.iv-repair--drag-float{
  position:fixed !important;
  z-index:10000;
  margin:0 !important;
  opacity:0.85 !important; /* ~15–20% transparent, clearly readable */
  pointer-events:none !important;
  background:#f8fbff !important;
  border:1px solid #60a5fa !important;
  border-radius:12px;
  box-shadow:0 16px 40px rgba(15,23,42,0.28) !important;
  list-style:none;
  cursor:grabbing;
}
.iv-repair--drag-ghost{
  opacity:0.85 !important;
  background:#f8fbff !important;
  border:1px solid #93c5fd !important;
  border-radius:12px;
  list-style:none;
}
.iv-notice-host{
  display:none;
  padding:0 14px;
}
.iv-notice-host.is-visible{ display:block; padding-top:10px; }
.iv-notice{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  padding:12px 14px;
  border-radius:12px;
  border:1px solid transparent;
  animation: ivNoticeIn 0.2s ease;
}
@keyframes ivNoticeIn{
  from { opacity:0; transform: translateY(-6px); }
  to   { opacity:1; transform: translateY(0); }
}
.iv-notice--error{
  background:#fef2f2;
  border-color:#fecaca;
  color:#991b1b;
}
.iv-notice--warning{
  background:#fff7ed;
  border-color:#fed7aa;
  color:#9a3412;
}
.iv-notice--info{
  background:#eff6ff;
  border-color:#bfdbfe;
  color:#1e40af;
}
.iv-notice__title{ font-weight:900; font-size:13px; margin-bottom:2px; }
.iv-notice__text{ font-size:13px; line-height:1.4; font-weight:600; }
.iv-notice__close{
  flex-shrink:0;
  border:0;
  border-radius:8px;
  padding:6px 12px;
  font-weight:800;
  font-size:12px;
  cursor:pointer;
  background:rgba(15,23,42,0.08);
  color:inherit;
}
.iv-notice__close:hover{ background:rgba(15,23,42,0.14); }
.iv-input--attention{
  outline:2px solid #f97316 !important;
  border-color:#f97316 !important;
  box-shadow:0 0 0 3px rgba(249,115,22,0.2);
}
@media (max-width: 900px){ .iv-layout{ grid-template-columns:1fr; } }
.iv-title{ font-weight:900; color:#0f172a; margin-bottom:8px; }
.iv-muted{ color:#64748b; font-weight:600; font-size:12px; }
.iv-toolbar{ margin-bottom:10px; flex:0 0 auto; }
.iv-filters{ display:flex; flex-wrap:wrap; gap:6px; margin:8px 0; }
.iv-chip{
  border:1px solid #e2e8f0; background:#fff; border-radius:999px; padding:5px 10px;
  font-size:12px; font-weight:700; cursor:pointer; color:#334155;
  display:inline-flex; align-items:center; gap:6px;
}
.iv-chip i{ font-size:12px; }
.iv-sector-icon{
  --iv-sector:#64748b;
  flex:0 0 auto;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:28px;
  height:28px;
  border-radius:8px;
  background:#f1f5f9;
  background:color-mix(in srgb, var(--iv-sector) 14%, #fff);
  border:1px solid #e2e8f0;
  border-color:color-mix(in srgb, var(--iv-sector) 35%, #e2e8f0);
  color:var(--iv-sector);
}
.iv-title--with-icon{
  display:flex; align-items:center; gap:10px;
}
.iv-steps{ list-style:none; margin:0; padding:0; }
.iv-plan-step{
  display:flex; align-items:flex-start; gap:8px;
  padding:8px 0;
  border-bottom:1px solid #f1f5f9;
}
.iv-plan-step:last-child{ border-bottom:0; }
.iv-sector-icon i{ font-size:13px; line-height:1; }
.iv-sector-icon--sm{
  width:22px;
  height:22px;
  border-radius:6px;
}
.iv-sector-icon--sm i{ font-size:11px; }
.iv-sector-icon--lg{
  width:34px;
  height:34px;
  border-radius:10px;
}
.iv-sector-icon--lg i{ font-size:15px; }
.iv-search-item__row{
  display:flex; align-items:center; gap:8px;
}
.iv-dep-name--with-icon{
  display:flex; align-items:center; gap:10px;
}
.iv-dep-link{
  display:flex; align-items:center; gap:8px;
  border:1px solid #e2e8f0; background:#fff; width:100%; text-align:left;
  padding:8px; border-radius:8px; cursor:pointer; margin-bottom:6px;
}
.iv-dep-link__text{ flex:1; min-width:0; }
.iv-chip.is-active{ background:#0f172a; color:#fff; border-color:#0f172a; }
.iv-search-row{ position:relative; }
.iv-input, .iv-textarea{
  width:100%; border:1px solid #cbd5e1; border-radius:10px; padding:10px; font-size:13px;
}
.iv-textarea{ resize:vertical; }
.iv-search-results{
  position:absolute; left:0; right:0; top:100%; z-index:5; background:#fff;
  border:1px solid #e2e8f0; border-radius:10px; max-height:220px; overflow:auto;
}
.iv-search-item{
  display:flex; flex-direction:column; width:100%; text-align:left; border:0; background:#fff;
  padding:8px 10px; cursor:pointer; border-bottom:1px solid #f1f5f9;
}
.iv-search-item:hover{ background:#f8fafc; }
.iv-repair-list{ list-style:none; margin:0; padding:0; overflow:auto; }
.iv-repair{
  display:flex; gap:8px; align-items:flex-start; padding:10px; border:1px solid #e2e8f0;
  border-radius:12px; margin-bottom:8px; background:#fff; cursor:grab;
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
  will-change: transform;
}
.iv-repair.is-blocked{ opacity:0.7; background:#fff7ed; cursor:not-allowed; }
.iv-repair--drop-target{
  border-color:#2563eb;
  background:#eff6ff;
  box-shadow: inset 0 0 0 1px rgba(37,99,235,0.25);
}
.iv-repair--swap{
  animation: ivRepairSwap 0.5s ease;
}
@keyframes ivRepairSwap{
  0%   { transform: translateY(6px); background:#dbeafe; border-color:#2563eb; }
  40%  { transform: translateY(-2px); background:#eff6ff; border-color:#3b82f6; }
  100% { transform: translateY(0); background:#fff; border-color:#e2e8f0; }
}
.iv-repair__handle{ color:#94a3b8; font-weight:900; padding:4px 6px; cursor:grab; touch-action:none; user-select:none; }
.iv-repair__rank{ width:22px; font-weight:900; color:#64748b; }
.iv-repair__body{ flex:1; min-width:0; }
.iv-repair__name{ font-weight:800; color:#0f172a; }
.iv-repair__meta{ font-size:12px; color:#64748b; margin-top:2px; }
.iv-repair__block{ font-size:12px; color:#c2410c; margin-top:4px; font-weight:700; }
.iv-repair__ops{ display:flex; gap:4px; flex-wrap:wrap; align-items:center; }
.btn--tiny{ padding:4px 8px; font-size:11px; border-radius:8px; border:1px solid #cbd5e1; background:#f8fafc; cursor:pointer; font-weight:800; }
.iv-list-hint{ font-size:11px; color:#94a3b8; margin-top:6px; }
.iv-impact-grid{ display:grid; gap:10px; }
.iv-metric{ border:1px solid #e2e8f0; border-radius:12px; padding:10px; background:#f8fafc; }
.iv-metric__label{ font-size:12px; font-weight:800; color:#475569; margin-bottom:4px; }
.iv-metric__hint{ font-size:11px; line-height:1.35; color:#64748b; margin-bottom:8px; font-weight:600; }
.iv-metric__row{ margin-top:6px; display:flex; align-items:center; justify-content:space-between; gap:8px; }
.iv-metric__tag{ font-size:11px; font-weight:700; color:#64748b; }
.iv-metric__delta{ margin-top:8px; font-size:11px; font-weight:800; color:#64748b; }
.iv-metric__delta.is-better{ color:#166534; }
.iv-metric__delta.is-worse{ color:#b91c1c; }
.iv-pill{ display:inline-flex; padding:4px 8px; border-radius:999px; font-size:12px; font-weight:800; }
.iv-pill--ginom{ background:#e2e8f0; color:#334155; }
.iv-pill--user{ background:#dbeafe; color:#1e40af; }
.iv-pill--user.is-worse{ background:#fee2e2; color:#b91c1c; }
.iv-pill--user.is-better{ background:#dcfce7; color:#166534; }
.iv-impact-intro{
  font-size:12px; line-height:1.45; color:#475569; margin:0 0 10px; font-weight:600;
}
.iv-legend{ display:flex; justify-content:space-between; font-size:11px; color:#64748b; margin:8px 0 10px; }
.iv-warn{ padding:8px 10px; border-radius:10px; font-size:12px; font-weight:700; margin-bottom:8px; }
.iv-warn--notice{ background:#eff6ff; color:#1d4ed8; }
.iv-warn--warning{ background:#fff7ed; color:#c2410c; }
.iv-warn--critical{ background:#fef2f2; color:#b91c1c; }
.iv-label{ display:block; font-size:12px; font-weight:800; color:#334155; margin:10px 0 6px; }
.iv-empty{ color:#64748b; font-size:13px; padding:10px; }
.iv-subview__header{ display:flex; flex-wrap:wrap; gap:10px; align-items:center; justify-content:space-between; margin-bottom:12px; }
.iv-breadcrumbs{ flex:1; font-size:13px; }
.iv-crumb{ border:0; background:transparent; color:#0369a1; font-weight:800; cursor:pointer; padding:0 2px; }
.iv-dep-cols{ display:grid; grid-template-columns:1fr 1fr; gap:12px; margin-top:12px; }
.iv-dep-card{ border:1px solid #e2e8f0; border-radius:12px; padding:12px; background:#f8fafc; }
.iv-dep-card--focus{ border-color:#38bdf8; }
.iv-dep-name{ font-size:18px; font-weight:900; }
.iv-dep-list{ list-style:none; margin:0; padding:0; }
.iv-alt-grid{ display:grid; grid-template-columns:repeat(3,1fr); gap:10px; }
@media (max-width:900px){ .iv-alt-grid, .iv-dep-cols{ grid-template-columns:1fr; } }
.iv-alt{ border:1px solid #e2e8f0; border-radius:12px; padding:12px; background:#fff; text-align:left; cursor:pointer; }
.iv-alt.is-active{ border-color:#2563eb; box-shadow:0 0 0 2px rgba(37,99,235,0.15); }
.iv-alt__title{ font-weight:900; margin-bottom:8px; }
.iv-alt__metrics{ font-size:12px; color:#475569; display:grid; gap:4px; }
.iv-badge{ font-size:10px; background:#dcfce7; color:#166534; padding:2px 6px; border-radius:999px; }
.iv-plan-detail{ margin-top:14px; border-top:1px solid #e2e8f0; padding-top:12px; }
.iv-why{ color:#334155; margin-bottom:10px; line-height:1.4; }
.results-item--intervention{ border-color:rgba(37,99,235,0.35); background:#f8fbff; }
