:root {
  --bg: #f6f7ff;
  --panel: #ffffff;
  --card: #ffffff;
  --text: #1b1f2a;
  --muted: #5c6478;

  --accent: #6c5ce7;
  --accent2: #00d2d3;
  --accent3: #ff7675;
  --success: #2daa5a;
  --warning: #ffa500;
  --danger: #e63946;

  --line: rgba(20, 30, 60, .14);
  --glow: rgba(108, 92, 231, .22);

  --radius: 18px;
  --shadow: 0 18px 40px rgba(24, 32, 56, .12);
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
}

* { box-sizing: border-box }
html, body { height: 100% }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  background: #ffffff;
  overflow-x: hidden;
}

.ambient {
  position: fixed; inset: 0;
  pointer-events: none;
  background: transparent;
  opacity: 0;
  animation: drift 12s ease-in-out infinite;
}
@keyframes drift {
  0% { transform: translateY(0) }
  50% { transform: translateY(12px) }
  100% { transform: translateY(0) }
}

.container {
  width: min(1200px, 92vw);
  margin: 0 auto;
  padding: 28px 0 80px;
}

.panel { padding: 24px 0 38px }
.panel-head { margin-bottom: 14px }
.panel-head h2 { margin: 0 0 6px; font-size: 26px }
.muted { color: var(--muted) }
.tiny { font-size: 12px }
code { font-family: var(--mono); font-size: .95em }

/* ── Topbar ── */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  background: rgba(255, 255, 255, .78);
  border-bottom: 1px solid rgba(20, 30, 60, .10);
  backdrop-filter: blur(12px);
  transform: translateY(-110%);
  transition: transform .55s ease;
}
.topbar.show { transform: translateY(0) }
.topbar-left { display: flex; gap: 10px; align-items: center }
.dot {
  width: 10px; height: 10px; border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 18px var(--glow);
}
.topbar-title { font-weight: 700; font-size: 13px; letter-spacing: .2px }
.topbar-nav { display: flex; gap: 12px; flex-wrap: wrap }
.navlink {
  color: var(--text); text-decoration: none;
  font-size: 13px; padding: 6px 10px; border-radius: 999px;
  border: 2px solid #e8e8ff;
  background: #ffffff;
  transition: all .2s ease;
}
.navlink:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 4px 12px rgba(108, 92, 231, .12);
}

/* ── Cards ── */
.card {
  background: #ffffff;
  border: 2px solid #f0f0f5;
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(108, 92, 231, .06);
  padding: 16px;
  margin: 4px;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.card:hover {
  border-color: #e8e8ff;
  box-shadow: 0 8px 24px rgba(108, 92, 231, .12);
}
.card h3 { margin: 0 0 10px; font-size: 18px }
.clean { margin: 0; padding-left: 18px }
.clean li { margin: 6px 0 }

/* ── Grid ── */
.grid { display: grid; gap: 24px }
.grid > * { min-width: 0 } /* prevent grid blowout */
.grid.two { grid-template-columns: 1fr }
@media (min-width: 900px) {
  .grid.two { grid-template-columns: 1fr 1fr }
}

/* ── Buttons ── */
.btn {
  border: 2px solid #e8e8ff;
  color: var(--text);
  background: #ffffff;
  padding: 10px 14px;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 700;
  transition: all .2s ease;
}
.btn:hover {
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(108, 92, 231, .15);
  /* No translateY - lifting the button moves it out from under the cursor,
     causing a flicker loop identical to the card hover bug. */
}

.full-width { width: 100%; display: block; text-align: center; }
.btn.primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  position: relative;
  overflow: hidden;
}
.btn.primary:hover {
  background: #5b4ad1;
  box-shadow: 0 8px 24px rgba(108, 92, 231, .25);
}
.btn.ghost { background: transparent; border-color: transparent }
.btn.ghost:hover {
  background: rgba(108, 92, 231, .08);
  border-color: var(--accent);
}
.btn.small {
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 12px;
}

.spark {
  position: absolute; inset: -40%;
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, .18), transparent 35%),
    radial-gradient(circle at 70% 80%, rgba(255, 255, 255, .10), transparent 35%);
  animation: spark 3s ease-in-out infinite;
}
@keyframes spark {
  0% { transform: rotate(0) }
  50% { transform: rotate(20deg) }
  100% { transform: rotate(0) }
}

/* ── Landing ── */
.landing {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 34px 0;
}
.landing-card {
  width: min(900px, 92vw);
  padding: 28px;
  border-radius: 28px;
  border: 3px solid #e8e8ff;
  background: #ffffff;
  box-shadow: 0 10px 40px rgba(108, 92, 231, .15);
  position: relative;
  overflow: hidden;
}
.landing-card::before {
  content: '';
  position: absolute; top: 0; left: 0;
  width: 100%; height: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent2), var(--accent3));
  opacity: .6;
}
.landing-card::after {
  content: '';
  position: absolute; top: -50%; right: -50%;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(108, 92, 231, .05), transparent 70%);
  pointer-events: none;
}
.badge {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 999px;
  border: 2px solid var(--accent);
  background: rgba(108, 92, 231, .08);
  color: var(--accent);
  font-weight: 800;
  letter-spacing: .3px;
  margin-bottom: 10px;
  transition: all .2s ease;
}
.badge:hover { background: var(--accent); color: white }
.landing h1 { margin: 0 0 10px; font-size: 38px; color: var(--text) }
.sub { margin: 0 0 14px; color: var(--muted); max-width: 60ch }
.names { margin: 14px 0 }
.names label {
  display: block; font-size: 12px; color: var(--accent);
  margin: 0 0 8px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .1px;
}
.hint { color: var(--muted); font-size: 12px }
.mini { display: grid; gap: 10px; margin-top: 14px }
@media (min-width: 900px) { .mini { grid-template-columns: 1fr 1fr } }
.mini-card {
  border-radius: 18px;
  border: 2px solid #f0f0f5;
  background: #ffffff;
  padding: 12px;
  transition: all .2s ease;
  position: relative; overflow: hidden;
}
.mini-card::before {
  content: '';
  position: absolute; top: 0; left: 0;
  width: 4px; height: 100%;
  background: var(--accent);
  opacity: 0; transition: opacity .3s ease;
}
.mini-card:hover { border-color: var(--accent2); box-shadow: 0 4px 16px rgba(0, 210, 211, .12) }
.mini-card:hover::before { opacity: 1 }
.mini-title { font-weight: 800; margin-bottom: 6px }
.mini-body { color: var(--muted); font-size: 13px }

/* ── Table of Contents ── */
.toc {
  margin-top: 24px;
  padding: 16px;
  border-radius: 18px;
  border: 2px solid #e8e8ff;
  background: rgba(108, 92, 231, .04);
}
.toc-title {
  display: block;
  font-size: 12px;
  color: var(--accent);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .1px;
  margin: 0 0 12px;
}
.toc-list {
  margin: 0;
  padding-left: 0;
  list-style: none;
}
.toc-list li {
  margin: 8px 0;
}
.toc-link {
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  padding: 6px 8px;
  border-radius: 8px;
  display: inline-block;
  transition: all .2s ease;
  border-left: 3px solid transparent;
  padding-left: 11px;
}
.toc-link:hover {
  color: var(--accent);
  background: rgba(108, 92, 231, .08);
  border-left-color: var(--accent);
}

/* ── Tabs ── */
.tabs { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0 14px }
.tab {
  padding: 9px 12px;
  border-radius: 999px;
  border: 2px solid #e8e8ff;
  background: #ffffff;
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
  font-size: 13px;
  transition: all .2s ease;
}
.tab:hover { border-color: var(--accent2) }
.tab.active { border-color: var(--accent); background: var(--accent); color: white }

/* ── DFD layout ── */
.dfd-grid { display: grid; gap: 14px }
@media (min-width: 1000px) { .dfd-grid { grid-template-columns: 1.6fr 1fr } }
.dfd-stage { min-height: 420px }
.dfd-view { display: none }
.dfd-view.active { display: block }

/* ── DFD toolbar (sits above the wrap) ── */
.dfd-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 2px solid var(--accent2);
  background: rgba(0, 210, 211, .08);
  font-weight: 800; font-size: 12px; color: var(--accent2);
  transition: all .2s ease;
}
.pill:hover {
  background: rgba(0, 210, 211, .15);
  box-shadow: 0 4px 12px rgba(0, 210, 211, .15);
}

/* ──────────────────────────────────────────────────────────────────────────
   DFD WRAP + ZOOM
   
   The image is scaled using CSS transform with a DYNAMIC transform-origin
   set to the hotspot's centre coordinates (set via JS).
   overflow:hidden clips the scaled image so it feels like a zoom-into-view.
   Hotspots are children of dfd-wrap so they scale identically with the image.
────────────────────────────────────────────────────────────────────────── */
.dfd-wrap {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;                          /* clips the zoomed image */
  border: 2px solid rgba(20, 30, 60, .10);
  background: rgba(0, 0, 0, .04);
  /* height is fixed so the container doesn't grow when image scales */
  aspect-ratio: 16 / 10;
  max-height: 520px;
}

.dfd-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  /* transform-origin is set per-component by JS */
  transform-origin: center center;
  transform: scale(1);
  transition: transform .45s cubic-bezier(0.4, 0, 0.2, 1),
              transform-origin 0s;           /* origin snaps instantly */
}

/* When the wrap has .zoomed, scale up the image */
.dfd-wrap.zoomed .dfd-img {
  transform: scale(2.6);
}

/* Highlight the wrap border when zoomed */
.dfd-wrap.zoomed {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108, 92, 231, .15);
}

/* -- Reset zoom button - shown only when zoomed -- */
.zoom-reset {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: rgba(108, 92, 231, .08);
  color: var(--accent);
  font-size: 12px; font-weight: 700;
  cursor: pointer;
  transition: all .2s ease;
  display: none;           /* hidden by default */
}
.zoom-reset:hover { background: var(--accent); color: white }

/* Show reset button whenever wrap is zoomed */
.dfd-wrap.zoomed ~ .dfd-toolbar .zoom-reset,
.dfd-toolbar:has(+ .dfd-wrap.zoomed) .zoom-reset {
  display: inline-block;
}

/* ── Hotspots ── */
.hotspot {
  position: absolute;
  border: 3px solid rgb(0, 255, 21);
  background: rgba(0, 210, 211, .15);
  border-radius: 12px;
  cursor: pointer;
  opacity: .55;
  transition: opacity .15s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease;
  /* NOTE: no transform on hotspots - they share the parent's scale */
  z-index: 5;
}
.hotspot:hover {
  opacity: .60;
  background: rgba(255, 118, 117, .16);
  border-color: rgba(255, 118, 117, .65);
  box-shadow: 0 0 14px rgba(255, 118, 117, .35);
}
.hotspot.active {
  opacity: .85;
  border-color: var(--accent);
  background: rgba(108, 92, 231, .20);
  box-shadow: 0 0 20px rgba(108, 92, 231, .40), inset 0 0 10px rgba(108, 92, 231, .15);
}

.hotspot.hidden {
  opacity: 0;
  pointer-events: none;
}

/* ── Filters ── */
.filters { display: grid; gap: 10px }
@media (min-width: 650px) { .filters { grid-template-columns: 1fr 1fr 1.4fr } }
.filter-toggle-container { position: relative; width: 100% }
.filter-toggle-container .select { width: 100%; position: relative }
.select, .input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 14px;
  border: 2px solid #e8e8ff;
  background: #ffffff;
  color: var(--text);
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.select:hover, .input:hover { border-color: var(--accent2) }
.select:focus, .input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108, 92, 231, .10);
}

/* ── Tables ── */
.table-wrap { overflow: auto; border-radius: 16px; border: 1px solid rgba(20, 30, 60, .10) }
.table { width: 100%; border-collapse: collapse; min-width: 1400px }
.table th, .table td {
  padding: 10px;
  border-bottom: 1px solid rgba(20, 30, 60, .08);
  font-size: 13px; vertical-align: top;
}
.table th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted) }
.table tbody tr { cursor: pointer; transition: background .2s ease, box-shadow .2s ease }
.table tbody tr:hover {
  background: rgba(108, 92, 231, .04);
  box-shadow: inset 4px 0 0 var(--accent);
}
.table td:nth-child(6),
.table td:nth-child(7),
.table td:nth-child(8),
.table td:nth-child(9),
.table td:nth-child(10),
.table td:nth-child(11) {
  text-align: center; font-weight: 900; color: var(--accent);
}

.tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 8px; border-radius: 999px;
  border: 1px solid rgba(20, 30, 60, .18);
  font-size: 12px; background: rgba(20, 30, 60, .04);
}
.tag.high { border-color: rgba(255, 118, 117, .70); background: rgba(255, 118, 117, .18) }
.tag.crit { border-color: rgba(108, 92, 231, .70); background: rgba(108, 92, 231, .18) }
.tag.med  { border-color: rgba(0, 210, 211, .70); background: rgba(0, 210, 211, .16) }
.tag.low  { border-color: rgba(45, 170, 90, .55); background: rgba(45, 170, 90, .14) }

.details { margin-top: 10px }
.details summary { cursor: pointer; color: var(--text); font-weight: 800; padding: 8px 0; transition: color .2s ease }
.details summary:hover { color: var(--accent) }
/* assumptions table sits inside a half-width card - let it scroll instead of breaking out */
.details .table-wrap { width: 100%; overflow-x: auto }
#assumptionsTable { min-width: 600px }

/* ── Risk Matrix ── */
.matrix {
  display: grid;
  grid-template-columns: 90px repeat(5, 1fr);
  gap: 8px;
  align-items: stretch;
}
.mhead {
  border-radius: 14px; border: 2px solid #e8e8ff; background: #ffffff;
  padding: 10px; font-size: 13px; font-weight: 900; color: var(--muted);
}
.mcell {
  border-radius: 14px; padding: 10px; font-size: 13px;
  cursor: pointer; font-weight: 700; border: 2px solid #e8e8ff; background: #ffffff;
  transition: transform .15s ease, border-color .15s ease, background .15s ease;
}
.mcell:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,.08) }
.mcell.active { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(108,92,231,.15) inset }

/* Risk score colour bands */
.mcell[data-score="1"],.mcell[data-score="2"],.mcell[data-score="3"],.mcell[data-score="4"] {
  border-color: var(--success); background: rgba(45,170,90,.10); color: #1a6b38;
}
.mcell[data-score="5"],.mcell[data-score="6"],.mcell[data-score="7"],.mcell[data-score="8"],.mcell[data-score="9"] {
  border-color: #b3a000; background: rgba(179,160,0,.08); color: #665d00;
}
.mcell[data-score="10"],.mcell[data-score="11"],.mcell[data-score="12"],
.mcell[data-score="13"],.mcell[data-score="14"],.mcell[data-score="15"],.mcell[data-score="16"] {
  border-color: var(--warning); background: rgba(255,165,0,.12); color: #cc8400;
}
.mcell[data-score="17"],.mcell[data-score="18"],.mcell[data-score="19"],.mcell[data-score="20"],
.mcell[data-score="21"],.mcell[data-score="22"],.mcell[data-score="23"],.mcell[data-score="24"],.mcell[data-score="25"] {
  border-color: #e63946; background: rgba(230,57,70,.12); color: #991620;
}

/* ── Matrix cell score and pips ── */
.mcell-score {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 6px;
}
.pips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
  margin-top: 6px;
}
.pip {
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
}
/* Pip colors match the cell background */
.mcell[data-score="1"] .pip,.mcell[data-score="2"] .pip,.mcell[data-score="3"] .pip,.mcell[data-score="4"] .pip { color: #1a6b38 }
.mcell[data-score="5"] .pip,.mcell[data-score="6"] .pip,.mcell[data-score="7"] .pip,.mcell[data-score="8"] .pip,.mcell[data-score="9"] .pip { color: #665d00 }
.mcell[data-score="10"] .pip,.mcell[data-score="11"] .pip,.mcell[data-score="12"] .pip,
.mcell[data-score="13"] .pip,.mcell[data-score="14"] .pip,.mcell[data-score="15"] .pip,.mcell[data-score="16"] .pip { color: #cc8400 }
.mcell[data-score="17"] .pip,.mcell[data-score="18"] .pip,.mcell[data-score="19"] .pip,.mcell[data-score="20"] .pip,
.mcell[data-score="21"] .pip,.mcell[data-score="22"] .pip,.mcell[data-score="23"] .pip,.mcell[data-score="24"] .pip,.mcell[data-score="25"] .pip { color: #991620 }

/* ── Matrix cell threat IDs ── */
.cell-threat-id {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
  font-size: 11px;
  padding: 2px 4px;
  border-radius: 4px;
  transition: all .2s ease;
  display: inline-block;
}
.cell-threat-id:hover {
  background: rgba(108, 92, 231, .15);
  text-decoration: underline;
}

.band-threat-link {
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
  transition: all .2s ease;
}
.band-threat-link:hover {
  color: var(--accent2);
  text-decoration: underline;
}

/* ── Highlighted threat row ── */
#threatTable tbody tr.highlighted {
  background: rgba(108, 92, 231, .08);
  box-shadow: inset 0 0 0 2px var(--accent);
}

/* ── Footer ── */
.footer { padding: 18px 0 40px; text-align: center }

/* ── Modal ── */
.modal {
  position: fixed; inset: 0;
  display: none; place-items: center;
  background: rgba(0,0,0,.55);
  z-index: 60;
}
.modal.show { display: grid }
.modal-card {
  width: min(760px, 92vw);
  border-radius: 20px;
  border: 1px solid rgba(20,30,60,.12);
  background: #ffffff;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(20,30,60,.08);
}
.modal-title { font-weight: 900 }
.modal-body { padding: 14px; color: var(--text) }

/* ── DFD side panel ── */
.dfd-panel { overflow-y: auto }
.dfd-panel-head { margin-bottom: 12px; border-bottom: 1px solid #f0f0f5; padding-bottom: 10px }
.dfd-panel-head h3 { margin: 0 0 4px }

.dfd-panel-body {
  animation: fadeIn 0.3s ease-in-out;
}
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dfd-panel-body .kv { margin-bottom: 12px }
.dfd-panel-body b { display: block; margin-bottom: 4px; font-size: 13px; color: var(--accent) }

/* ── DFD Panel Pagination ── */
.dfd-panel-action { margin-bottom: 12px }
.dfd-panel-action .btn.full-width {
  width: 100%;
  display: block;
}

.dfd-panel-nav { margin-top: 18px; border-top: 1px solid #f0f0f5; padding-top: 12px }
.dfd-panel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.page-indicator {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.3px;
}
.page-num {
  color: var(--accent);
  font-weight: 700;
}
.dfd-panel-footer .btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.dfd-panel-footer .btn {
  flex: 1;
  font-size: 12px;
  padding: 8px 12px;
}

/* ── Remediations Section ── */
.remediation-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}

#remedThreatsList {
  margin: 0;
  padding-left: 0;
}

#remedThreatsList li {
  list-style: none;
  margin: 8px 0;
  padding: 0;
}

.threat-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 2px solid #f0f0f5;
  background: #ffffff;
  cursor: pointer;
  transition: all .2s ease;
}

.threat-item:hover {
  border-color: var(--accent2);
  box-shadow: 0 4px 12px rgba(0, 210, 211, .12);
  transform: translateX(4px);
}

.threat-item.active {
  border-color: var(--accent);
  background: rgba(108, 92, 231, .08);
  box-shadow: inset 4px 0 0 var(--accent);
}

.threat-item-id {
  font-weight: 900;
  font-size: 12px;
  color: var(--accent);
  flex-shrink: 0;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(108, 92, 231, .12);
}

.threat-item-name {
  flex: 1;
  font-weight: 600;
  font-size: 13px;
}

.threat-item-risk {
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.threat-item-risk.high {
  background: rgba(230, 57, 70, .15);
  color: #991620;
}

.threat-item-risk.med {
  background: rgba(255, 165, 0, .15);
  color: #cc8400;
}

.threat-item-risk.low {
  background: rgba(45, 170, 90, .15);
  color: #1a6b38;
}

/* Mitigation detail pane */
.mitigation-detail {
  animation: fadeIn 0.3s ease-in-out;
}

/* ROI badge and coverage table enhancements */
.roi-badge {
  display: inline-block;
  background: var(--accent-light, #e8e8ff);
  color: var(--accent-dark, #6c5ce7);
  border-radius: 4px;
  padding: 0 4px;
  font-size: 0.75rem;
  margin-right: 4px;
}
#controlMappingTable tbody tr:hover {
  background: rgba(108, 92, 231, .04);
}

/* highlight rows where a control blocks more than one threat (high ROI) */
#controlMappingTable tbody tr[data-roi]:not([data-roi="1"]) {
  background: rgba(0, 210, 211, .08);
}
.control-impl {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}
.control-target {
  font-size: 11px;
  color: var(--accent2);
  margin-top: 2px;
}


.mitigation-threat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 2px solid #f0f0f5;
}

.mitigation-threat-header .threat-id-badge {
  padding: 6px 12px;
  border-radius: 8px;
  background: rgba(108, 92, 231, .15);
  color: var(--accent);
  font-weight: 800;
  font-size: 12px;
}

.mitigation-threat-header .threat-name {
  flex: 1;
}

.mitigation-threat-header .threat-name h4 {
  margin: 0;
  font-size: 15px;
  color: var(--text);
}

.mitigation-threat-header .threat-name p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
}

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

.mitigation-item {
  padding: 12px;
  border-radius: 12px;
  border: 2px solid #f0f0f5;
  background: rgba(0, 210, 211, .04);
  transition: all .2s ease;
}

.mitigation-item:hover {
  border-color: var(--accent2);
  background: rgba(0, 210, 211, .08);
  box-shadow: 0 4px 12px rgba(0, 210, 211, .12);
}

.mitigation-item h5 {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 800;
  color: var(--accent2);
  display: flex;
  align-items: center;
  gap: 6px;
}

.mitigation-item p {
  margin: 0;
  font-size: 12px;
  color: var(--text);
  line-height: 1.5;
}

.mitigation-item .mitigation-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.mitigation-tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(108, 92, 231, .10);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
}

.remediate-action {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 2px solid #f0f0f5;
  display: flex;
  gap: 8px;
}

.remediate-action .btn {
  flex: 1;
}

/* ───────── Security Mitigation Pack ───────── */

.mitigation-pack-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 2px solid #f0f0f5;
}

.pack-controls {
  margin-bottom: 20px;
}

.card-stage { display: block; }

/* Simulator layout */
.simulator {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-items: start;
}

.attack-flow {
  background: #ffffff;
  border: 2px solid #f0f0f5;
  padding: 14px;
  border-radius: 12px;
}

.flow-step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 8px 0;
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity .32s ease, transform .32s ease;
  position: relative;
}
.flow-step.visible { opacity: 1; transform: translateX(0); }
.flow-step .step-bubble {
  min-width: 36px; height: 36px; border-radius: 999px;
  background: rgba(108,92,231,.08); color: var(--accent);
  display: grid; place-items: center; font-weight: 800;
}
.flow-step .step-content { flex: 1 }
.flow-step .step-title { font-weight: 800; color: var(--text); }
.flow-step .step-sub { font-size: 12px; color: var(--muted) }

.flow-step.blocked { opacity: .5; filter: grayscale(.2); }
.flow-step.blocked::after {
  content: 'BLOCKED'; position: absolute; right: 12px; top: 12px;
  background: rgba(230,57,70,.12); color: #991620; padding: 4px 8px; border-radius: 999px; font-weight: 800; font-size: 11px;
}

.controls-panel {
  background: #ffffff;
  border: 2px solid #f0f0f5;
  padding: 14px;
  border-radius: 12px;
}
.control-item {
  display: flex; gap: 12px; align-items: center;
  padding: 10px; border-radius: 10px; border: 1px solid transparent;
  transition: all .28s ease; margin: 8px 0; background: rgba(108,92,231,.03);
}
.control-item .control-name { font-weight: 800; color: var(--accent); }
.control-item .control-desc { font-size: 12px; color: var(--muted) }
.control-item .control-indicator { margin-left: auto; min-width: 32px; text-align: center; font-weight: 900 }
.control-item.active { border-color: rgba(108,92,231,.12); background: rgba(108,92,231,.08); box-shadow: 0 8px 24px rgba(108,92,231,.08) }

.sim-controls-note { font-size: 12px; color: var(--muted); margin-top: 8px }

/* small responsive tweaks */
@media (max-width: 860px) { .simulator { grid-template-columns: 1fr } }

/* Ensure remediation columns align and scroll independently */
#remediationGrid .card { display: flex; flex-direction: column; }
#remediationGrid .card > .dfd-panel-body,
#remediationGrid .card > #remedDetail { max-height: 500px; overflow-y: auto; }

/* Keep table wrap reasonable height for long lists */
.table-wrap { max-height: 56vh; overflow: auto; }