:root {
  --ink: #172033;
  --muted: #637083;
  --shadow: 0 18px 50px rgba(20, 35, 70, 0.12);
  --radius: 22px;
  --panel-border: #d6deeb;
  --scenario-accent: #7256ad;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, Segoe UI, Arial, sans-serif;
  background: linear-gradient(135deg, #eef4ff, #f8fbff);
  color: var(--ink);
}

.shell {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  background: #0f1b2d;
  color: white;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sidebarMenu {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: inherit;
}

.sidebarMenu[hidden] {
  display: none;
}

.sidebarToggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: flex-start;
  gap: 8px;
  min-width: 44px;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: #eaf1ff;
  cursor: pointer;
}

.sidebarToggle:hover {
  background: #25436c;
}

.sidebarToggle:focus-visible {
  outline: 3px solid #bca3ed;
  outline-offset: 3px;
}

.sidebarToggleIcon {
  font-size: 24px;
  line-height: 1;
}

.shell.sidebarCollapsed {
  grid-template-columns: 72px minmax(0, 1fr);
}

.sidebarCollapsed .sidebar {
  padding: 20px 12px;
}

.sidebarCollapsed .sidebarToggleLabel {
  display: none;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: stretch;
  margin-bottom: 18px;
}

.logo {
  display: block;
  width: 100%;
  max-width: 254px;
  height: auto;
  border-radius: 12px;
  background: #fff;
}

.brand h1 {
  font-size: 21px;
  margin: 0;
}

.brand p {
  margin: 2px 0 0;
  color: #b9c7d9;
  font-size: 13px;
}

.nav {
  border: 0;
  border-radius: 16px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.08);
  color: #eaf1ff;
  text-align: left;
  font-size: 15px;
  cursor: pointer;
}

.nav:hover,
.nav.active {
  background: linear-gradient(135deg, #276ef1, #1fb6a6);
}

.sourceBox {
  margin-top: auto;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 14px;
  border-radius: 16px;
  color: #cbd7e8;
  font-size: 13px;
}

main {
  padding: 34px;
  height: 100vh;
  overflow: auto;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.hero,
.toolbar,
.infoPanel {
  background: #fff;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius);
}

.hero {
  padding: 36px;
  margin-bottom: 22px;
}

.hero h2,
.toolbar h2 {
  font-size: 34px;
  margin: 0 0 8px;
}

.toolbar {
  padding: 22px 24px;
  margin-bottom: 18px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
}

.filters {
  display: flex;
  gap: 12px;
  align-items: end;
  flex-wrap: wrap;
}

.filters label {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filters label[hidden] {
  display: none;
}

.filterActions {
  display: flex;
  gap: 12px;
  width: 100%;
}

select,
button {
  font: inherit;
}

select {
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 10px 12px;
  background: white;
  min-width: 190px;
}

.secondary {
  border: 0;
  border-radius: 13px;
  padding: 10px 14px;
  background: #edf3ff;
  color: #164ea6;
  cursor: pointer;
}

.legendRow {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin: 0 0 12px;
}

.legendHelp {
  color: var(--muted);
  font-size: 13px;
}

.categoryLegend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.legendItem {
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  background: white;
  padding: 8px 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.swatch {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  display: inline-block;
  border: 1px solid rgba(0, 0, 0, 0.16);
}

.statusLegend {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 13px;
}

.s {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  display: inline-block;
}

.s.supported {
  background: #17a567;
}

.s.draft {
  background: #d69b00;
}

.s.not_found {
  background: #8a0f1a;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(320px, 0.9fr);
  gap: 18px;
  align-items: start;
}

.graphWrap {
  display: flex;
  flex-direction: column;
  padding: 10px;
  border: 2px solid var(--scenario-accent);
  position: sticky;
  top: 0;
  align-self: start;
  max-height: calc(100vh - 68px);
  overflow: hidden;
}

.graphSettings {
  flex-shrink: 0;
  padding: 12px;
  margin-bottom: 10px;
  border: 1px solid #e1d8ef;
  border-radius: 14px;
  background: #f7f4fc;
}

.graphSettings .filters label {
  flex: 1 1 190px;
  min-width: 0;
}

.graphSettings select {
  width: 100%;
  min-width: 0;
  border-color: #d3c7e7;
  color: var(--ink);
}

.graphSettings select:focus-visible {
  outline: 2px solid var(--scenario-accent);
  outline-offset: 2px;
}

.graphSettings .filterActions {
  flex-wrap: wrap;
  gap: 8px;
}

.graphWrap .secondary {
  background: #eee8f8;
  color: #574080;
}

.graphWrap .secondary:hover:not(:disabled) {
  background: #e1d6f1;
}

.graphControls {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 10px;
}

.graphControls output {
  min-width: 46px;
  text-align: center;
  font-size: 13px;
}

.graphControls button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.graphPanHint {
  color: var(--muted);
  font-size: 12px;
}

.graphViewport {
  --migration-zoom: 1;
  --graph-height: 760px;
  height: min(65vh, 760px);
  min-height: 160px;
  max-height: calc(100vh - 240px);
  overflow: auto;
  border-radius: 18px;
  cursor: grab;
  touch-action: none;
}

.graphViewport.panning {
  cursor: grabbing;
  user-select: none;
}

.graphViewport:focus-visible {
  outline: 3px solid var(--scenario-accent);
  outline-offset: -3px;
}

.scenarioTabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 0 10px;
  background: transparent;
}

.scenarioTab {
  border: 1px solid #cbd2dc;
  border-radius: 10px;
  padding: 8px 12px;
  background: #edf0f4;
  color: #526071;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.scenarioTab:hover {
  border-color: var(--scenario-accent);
  color: #574080;
}

.scenarioTab[aria-pressed="true"] {
  border-color: var(--scenario-accent);
  background: var(--scenario-accent);
  color: #fff;
}

.scenarioTab:focus-visible {
  outline: 3px solid var(--scenario-accent);
  outline-offset: 3px;
}

#depSvg {
  width: calc(100% * var(--migration-zoom));
  height: calc(var(--graph-height) * var(--migration-zoom));
  display: block;
  background: radial-gradient(circle at top left, rgba(255,255,255,0.95), rgba(233,241,255,0.95));
  border-radius: 18px;
}

.sidePanel {
  padding: 18px;
  display: grid;
  gap: 14px;
}

.panelSection {
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  overflow: hidden;
}

.panelSection.hidden {
  display: none;
}

.panelSection h3 {
  margin: 0;
  padding: 14px 16px;
  font-size: 16px;
  border-bottom: 1px solid var(--panel-border);
  background: #f7faff;
}

.panelBody {
  padding: 16px;
}

.panelBody h4 {
  margin: 18px 0 10px;
  font-size: 15px;
}

.panelBody h4:first-child {
  margin-top: 0;
}

.placeholder {
  margin: 0;
  color: var(--muted);
}

.node text {
  font-size: 13px;
  fill: #172033;
  pointer-events: none;
}

.node rect {
  filter: drop-shadow(0 8px 16px rgba(32, 47, 85, 0.08));
}

.node.dragging rect {
  filter: drop-shadow(0 18px 28px rgba(32, 47, 85, 0.16));
}

.node.selected rect {
  filter: drop-shadow(0 0 24px rgba(56, 132, 255, 0.95)) drop-shadow(0 28px 56px rgba(26, 71, 154, 0.62));
}

.edge {
  fill: none;
  stroke: #5f6f87;
  stroke-width: 2;
}

.edge.selected {
  stroke: #254f9a;
  stroke-width: 4;
}

.statusBadge {
  fill: white;
  font-size: 11px;
  font-weight: 700;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  margin: 0 8px 8px 0;
  border-radius: 999px;
  background: #eef4ff;
  color: #35548c;
  font-size: 12px;
  font-weight: 600;
}

.miniList {
  margin: 0;
  padding-left: 18px;
}

.miniList li {
  margin-bottom: 8px;
}

.sourceSmall {
  color: var(--muted);
  font-size: 12px;
  margin-top: 14px;
}

.statusGrid {
  display: grid;
  gap: 10px;
}

.statusCard {
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 12px 14px;
  background: #fbfdff;
}

.statusCard.supported {
  background: #e8f6ee;
  border-color: #bfe3ce;
}

.statusCard.draft {
  background: #fbf1da;
  border-color: #f0d8a0;
}

.statusCard p {
  margin: 6px 0 0;
}

.cardHeader {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.cardHeader b {
  font-size: 15px;
}

.rfcBadge {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: #dae8fc;
  color: #21457d;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.dataOverview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.dataCard {
  text-align: left;
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  background: #fff;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.dataCard:hover {
  border-color: #9db8e8;
  box-shadow: 0 10px 24px rgba(39, 110, 241, 0.14);
  transform: translateY(-2px);
}

.dataCard.active {
  border-color: #276ef1;
  box-shadow: 0 10px 26px rgba(39, 110, 241, 0.22);
}

.dataCardName {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  color: #164ea6;
}

.dataCardTitle {
  font-size: 15px;
  font-weight: 700;
  color: #172033;
}

.dataCardDesc {
  font-size: 12px;
  color: var(--muted);
}

.dataTableWrap {
  padding: 18px;
}

.dataTableHead {
  margin: 0 0 12px;
}

.dataTableHead h3 {
  margin: 0 0 4px;
  font-size: 17px;
}

.excelTable {
  overflow: auto;
  max-height: calc(100vh - 260px);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: #fff;
}

.excelTable table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
}

.excelTable th,
.excelTable td {
  border: 1px solid #e2e8f2;
  padding: 7px 10px;
  text-align: left;
  vertical-align: top;
  white-space: pre-wrap;
  min-width: 90px;
  max-width: 420px;
}

.excelTable thead th {
  position: sticky;
  top: 0;
  background: #eef4ff;
  color: #22335a;
  font-weight: 700;
  z-index: 2;
}

.excelTable tbody tr:nth-child(even) {
  background: #f7faff;
}

.excelTable tbody tr:hover {
  background: #eaf1ff;
}

.excelTable .rowNum {
  position: sticky;
  left: 0;
  background: #f0f3f8;
  color: var(--muted);
  text-align: right;
  min-width: 44px;
  font-variant-numeric: tabular-nums;
  z-index: 1;
}

.excelTable thead .rowNum {
  z-index: 3;
}

.choiceMap {
  background: #fff;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 18px;
}

.choiceMapBar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.choiceMapTitle {
  font-weight: 700;
  color: var(--ink);
}

.choiceMapZoom {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.choiceMapHint {
  color: var(--muted);
  font-size: 13px;
}

.choiceMapZoom .secondary {
  padding: 6px 12px;
  font-weight: 700;
}

.choiceMapScroll {
  max-height: 60vh;
  overflow: auto;
  border-radius: 18px;
  background: linear-gradient(180deg, #f8fbff, #eef4ff);
  border: 1px solid var(--panel-border);
}

#choiceSvg {
  display: block;
  margin: 0 auto;
}

.fedge {
  fill: none;
  stroke: #aab8d2;
  stroke-width: 2;
  stroke-linejoin: round;
}

.fedge.visited {
  stroke: #2f62b5;
  stroke-width: 3;
}

.fedgeLabel {
  fill: #55627a;
  font-weight: 600;
}

.fedgeLabel.visited {
  fill: #2f62b5;
}

.fnode {
  cursor: grab;
}

.fnode.dragging {
  cursor: grabbing;
}

.fnode .fshape {
  fill: #fff;
  stroke: #8ea0be;
  stroke-width: 1.5;
  filter: drop-shadow(0 6px 10px rgba(33, 49, 84, 0.08));
}

.fnode text {
  fill: #172033;
  pointer-events: none;
}

.fnode.start .fshape {
  fill: #e3efff;
  stroke: #5f86c6;
}

.fnode.decision .fshape {
  fill: #fff4d3;
  stroke: #d3b048;
}

.fnode.outcome .fshape,
.fnode.end .fshape {
  fill: #e7f7ee;
  stroke: #5bb98a;
}

.fnode:hover .fshape {
  stroke-width: 2.5;
}

.fnode.visited .fshape {
  stroke: #2f62b5;
}

.fnode.current .fshape {
  stroke: #0f5bd7;
  stroke-width: 3.5;
}

.assistant {
  background: #fff;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius);
  padding: 28px;
}

.choicePath {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.choicePath:empty {
  display: none;
}

.crumb {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #f2f6ff;
  color: var(--muted);
  font-size: 12px;
}

.crumb b {
  color: #164ea6;
}

.choicePrompt {
  font-size: 20px;
  font-weight: 700;
  margin: 6px 0 18px;
}

.choiceOptions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.choiceOpt {
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 14px 18px;
  background: #fbfdff;
  color: var(--ink);
  font-size: 15px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.choiceOpt:hover {
  border-color: #276ef1;
  box-shadow: 0 8px 18px rgba(39, 110, 241, 0.14);
}

.choiceResult {
  border: 1px solid #cfe6dd;
  border-radius: 18px;
  padding: 22px 24px;
  background: linear-gradient(135deg, #f0fbf6, #f6fbff);
  margin-bottom: 18px;
}

.resultTag {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  background: #17a567;
  color: white;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.choiceResult h3 {
  font-size: 28px;
  margin: 12px 0 0;
}

.resultTag.alt {
  background: #35548c;
}

.info {
  margin: 14px 0 0;
  padding-left: 18px;
  color: var(--muted);
}

.info li {
  margin-bottom: 6px;
}

.choiceResult .openScenario {
  margin-top: 16px;
}

.hybridGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.hybridCard {
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  padding: 18px;
  background: #fbfdff;
}

.hybridCard h3 {
  margin: 12px 0 0;
  font-size: 23px;
}

.hybridCard .openScenario {
  margin-top: 16px;
}

.choiceControls {
  display: flex;
  gap: 12px;
  margin-top: 22px;
}

.choiceControls button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

@media (max-width: 1180px) {
  .shell,
  .shell.sidebarCollapsed {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }

  .sidebar {
    gap: 12px;
  }

  .choiceMap {
    position: static;
  }

  .choiceMapScroll {
    max-height: 55vh;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  main {
    height: auto;
    overflow: visible;
  }

  .graphWrap {
    position: static;
    max-height: none;
    min-height: 620px;
    overflow: visible;
  }

  .graphViewport {
    --graph-height: 600px;
  }
}
/* Tool links and info overlay */
.toolLink { color: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.toolLink:hover { opacity: 0.8; }
.heroHead { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.infoBtn { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; border: 2px solid #2563eb; background: #eff6ff; color: #1d4ed8; font-weight: 700; cursor: pointer; white-space: nowrap; }
.infoBtn:hover, .infoBtn[aria-expanded="true"] { background: #2563eb; color: #fff; }
.infoIcon { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; background: #2563eb; color: #fff; font: italic 700 14px Georgia, serif; }
.infoBtn:hover .infoIcon, .infoBtn[aria-expanded="true"] .infoIcon { background: #fff; color: #2563eb; }
.infoOverlay { position: fixed; inset: 0; z-index: 1000; background: rgba(15, 23, 42, 0.55); display: flex; align-items: center; justify-content: center; padding: 24px; }
.infoOverlay[hidden] { display: none; }
.infoDialog { position: relative; background: #fff; color: var(--ink); max-width: 760px; max-height: 85vh; overflow-y: auto; border-radius: var(--radius); padding: 28px 32px; box-shadow: var(--shadow); line-height: 1.55; }
.infoDialog h3 { margin: 0 0 10px; }
.infoDialog h3:not(:first-of-type) { margin-top: 22px; }
.infoDialog b { color: #1d4ed8; }
.infoDialog li { margin-bottom: 6px; }
.infoClose { position: absolute; top: 10px; right: 14px; border: 0; background: none; font-size: 28px; line-height: 1; cursor: pointer; color: var(--muted); }

/* Scenarios page */
.scenariosContainer {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 24px;
}

.scenarioCard {
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 28px;
  background: #fbfdff;
  box-shadow: 0 4px 12px rgba(20, 35, 70, 0.08);
  transition: box-shadow 0.2s, transform 0.2s;
}

.scenarioCard:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.scenarioCard h3 {
  font-size: 24px;
  margin: 0 0 12px;
  color: var(--ink);
}

.scenarioSummary {
  font-size: 15px;
  color: var(--muted);
  margin: 0 0 18px;
  font-style: italic;
}

.scenarioContent {
  color: var(--ink);
}

.scenarioContent p {
  margin: 0 0 14px;
  line-height: 1.6;
}

.scenarioContent h4 {
  font-size: 15px;
  font-weight: 700;
  margin: 18px 0 10px;
  color: #1d4ed8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.scenarioContent ul {
  margin: 0 0 14px 0;
  padding-left: 20px;
}

.scenarioContent li {
  margin-bottom: 8px;
  line-height: 1.5;
}

/* Choice assistant why field */
.choiceWhy {
  margin: 16px 0;
  padding: 14px 16px;
  background: #f0f4ff;
  border-left: 4px solid #2563eb;
  color: var(--ink);
  line-height: 1.6;
  border-radius: 4px;
}

.choiceWhy br {
  margin-bottom: 8px;
}

.choiceContextSection {
  margin: 16px 0;
}

.choiceContextToggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #164ea6;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  text-align: left;
  transition: all 0.2s ease;
}

.choiceContextToggle::before {
  content: '▼';
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  transition: transform 0.2s ease;
}

.choiceContextToggle:hover {
  border-color: #2563eb;
  background: #eff6ff;
  color: #1d4ed8;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.1);
}

.choiceContextToggle:active {
  color: #1e40af;
}

.choiceContextToggle[data-context-open="true"]::before {
  transform: rotate(-180deg);
}

.choiceContextContent {
  overflow: hidden;
  max-height: 1000px;
  opacity: 1;
  transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;
  margin-top: 12px;
}

.choiceContextContent[hidden] {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  margin-top: 0;
}


