/* =========================================================================
   Swimlane process-flow renderer
   ========================================================================= */

.swimlane-doc {
  background: #ffffff;
  color: #0f172a;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  border: 1px solid #d0d7de;
  border-radius: 10px;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.3;
}

.swimlane-title {
  background: #14532d;       /* deep green like reference */
  color: #ffffff;
  padding: 10px 18px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-align: center;
  text-transform: uppercase;
  border-bottom: 2px solid #064e3b;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.25;
  min-height: 38px;
}

.swimlane-grid {
  position: relative;            /* SVG overlay anchor */
  display: grid;
  background: #ffffff;
}

/* SVG overlay sits on top of the grid and never blocks clicks. */
.swimlane-arrows {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 2;
}
.swimlane-arrows path { fill: none; stroke: #475569; stroke-width: 1.1px; }
.swimlane-arrows .arrow-dashed { stroke-dasharray: 4 3; }
.swimlane-arrows .arrow-thick  { stroke-width: 1.8px; }
.swimlane-arrows text {
  font-size: 12px;
  font-weight: 600;
  fill: #be123c;             /* red-ish like reference labels */
  paint-order: stroke;
  stroke: #ffffff;
  stroke-width: 3px;
}

/* Lane header column (left) */
.swimlane-lane-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 14px 8px;
  color: #ffffff;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.4px;
  border-bottom: 1px solid rgba(255,255,255,0.25);
  /* Allow long lane names / subtitles to wrap inside the 150px header. */
  min-width: 0;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  hyphens: auto;
}
.swimlane-lane-header .lane-name,
.swimlane-lane-header .lane-subtitle {
  width: 100%;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.swimlane-lane-header .lane-icon { font-size: 22px; line-height: 1; }
.swimlane-lane-header .lane-subtitle {
  font-weight: 500;
  font-size: 11px;
  text-transform: none;
  opacity: 0.92;
}

/* Lane body row */
.swimlane-lane-body {
  position: relative;
  border-bottom: 1px solid #e2e8f0;
  background: #fbfdff;
  min-height: 110px;
  padding: 14px 16px;
}
.swimlane-lane-body.alt { background: #f3f7fb; }

/* Step nodes: positioned absolutely inside their lane body. */
.swim-step {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: max-content;
  min-width: 120px;
  max-width: 240px;
  background: #eaf2ff;
  border: 1.5px solid #1d4ed8;
  border-radius: 6px;
  padding: 8px 10px 8px 28px;
  font-size: 12px;
  font-weight: 600;
  color: #0f172a;
  box-shadow: 0 1px 2px rgba(15,23,42,0.08);
  z-index: 3;
  cursor: pointer;
}
.swim-step.is-selected {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(37,99,235,0.25);
}
.swimlane-lane-header { cursor: pointer; }
.swim-step .step-number {
  position: absolute;
  top: -10px;
  left: -10px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #1d4ed8;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #ffffff;
  z-index: 4;
}
.swim-step .step-number-inline {
  display: inline-flex;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #1d4ed8;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  align-items: center; justify-content: center;
  margin-right: 6px;
}
.swim-step .step-label {
  display: block;
  font-weight: 700;
  color: #0f172a;
}
.swim-step .step-sublabel {
  display: block;
  font-weight: 400;
  font-size: 11px;
  color: #475569;
  margin-top: 2px;
}
.swim-step .step-sublabel-list {
  margin: 2px 0 0;
  padding-left: 16px;
  list-style-position: outside;
}
.swim-step .step-sublabel-list li {
  font-size: 11px;
  font-weight: 400;
  color: #475569;
  line-height: 1.3;
}
.swim-step .step-sublabel-line {
  font-size: 11px;
  font-weight: 400;
  color: #475569;
}
.swim-step .step-badges {
  position: absolute;
  top: -8px; right: -8px;
  display: flex; gap: 2px;
}
.swim-step .step-badge {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #facc15;
  color: #1f2937;
  font-size: 9px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #ffffff;
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}
.swim-step .step-badge.iesos { background: #16a34a; color: #ffffff; }

/* Shape variants */
.swim-step.shape-decision {
  --diamond-size: 90px;
  background: #fee2e2;
  border-color: #b91c1c;
  border-radius: 0;
  /* Center on the (left, top) point so the diamond's visual center sits
     on the column-center anchor, regardless of its size. */
  transform: translate(-50%, -50%) rotate(45deg);
  width: var(--diamond-size); height: var(--diamond-size);
  min-width: 0; max-width: none;
  padding: 0;
  display: flex; align-items: center; justify-content: center;
}
.swim-step.shape-decision .decision-inner {
  transform: rotate(-45deg);
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: #7f1d1d;
  padding: 0 4px;
  /* Upright content can only use the diamond's inscribed square,
     which has side length = S / √2 ≈ 0.707 * S. */
  width: calc(var(--diamond-size) * 0.707 - 8px);
  max-height: calc(var(--diamond-size) * 0.707 - 8px);
  overflow: hidden;
}
.swim-step.shape-decision .step-number,
.swim-step.shape-decision .step-badges {
  transform: rotate(-45deg);
}
.swim-step.shape-terminator {
  background: #dcfce7;
  border-color: #15803d;
  border-radius: 999px;
  color: #14532d;
  text-align: center;
  padding: 8px 14px;
}
/* Parallelogram = input / output data. Slanted via clip-path. */
.swim-step.shape-parallelogram {
  background: #fef3c7;
  border-color: #b45309;
  border-radius: 0;
  color: #78350f;
  /* Skew the box visually with clip-path so the border still renders. */
  clip-path: polygon(14% 0, 100% 0, 86% 100%, 0 100%);
  padding: 8px 22px 8px 36px;
}

/* Footer panels */
.swimlane-footer {
  display: grid;
  grid-template-columns: 1.1fr 1.4fr 1fr;
  gap: 0;
  border-top: 2px solid #cbd5e1;
}
.swimlane-footer > .swim-panel {
  padding: 10px 14px;
  border-right: 1px solid #e2e8f0;
  font-size: 12px;
}
.swimlane-footer > .swim-panel:last-child { border-right: none; }
.swim-panel h6 {
  margin: 0 0 6px 0;
  font-size: 11px;
  font-weight: 800;
  color: #1e3a8a;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border-bottom: 1.5px solid #1e3a8a;
  padding-bottom: 3px;
}
.swim-panel.statement {
  background: #fff5f5;
  border-left: 4px solid #be123c;
}
.swim-panel.statement h6 { color: #9f1239; border-bottom-color: #be123c; }
.swim-panel ul { padding-left: 16px; margin: 0; }
.swim-panel li { margin-bottom: 2px; }
.swim-panel div { white-space: normal; word-break: break-word; overflow-wrap: anywhere; }
.swim-panel .panel-row {
  display: flex; gap: 6px; align-items: baseline;
  margin-bottom: 3px;
  white-space: normal;
}
.swim-panel .panel-row .code {
  display: inline-block;
  min-width: 36px;
  background: #1e3a8a;
  color: #ffffff;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 700;
  text-align: center;
}

/* Legend strip (shapes + badges + reference items combined) */
.swimlane-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  padding: 8px 14px;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
  font-size: 11px;
  color: #334155;
}
.swimlane-legend .legend-item {
  display: inline-flex; align-items: center; gap: 6px;
}
.swimlane-legend .swatch-step,
.swimlane-legend .swatch-decision,
.swimlane-legend .swatch-terminator,
.swimlane-legend .swatch-parallelogram,
.swimlane-legend .swatch-document {
  width: 14px; height: 14px; display: inline-block;
}
.swimlane-legend .swatch-step       { background: #eaf2ff; border: 1.5px solid #1d4ed8; border-radius: 2px; }
.swimlane-legend .swatch-decision   { background: #fee2e2; border: 1.5px solid #b91c1c; transform: rotate(45deg); width: 10px; height: 10px; }
.swimlane-legend .swatch-terminator { background: #dcfce7; border: 1.5px solid #15803d; border-radius: 999px; width: 18px; height: 12px; }
.swimlane-legend .swatch-parallelogram,
.swimlane-legend .swatch-document   { background: #fef3c7; border: 1.5px solid #b45309; clip-path: polygon(20% 0, 100% 0, 80% 100%, 0 100%); width: 18px; height: 12px; border-radius: 0; }
.swimlane-legend .legend-badge {
  width: 16px; height: 16px; border-radius: 50%;
  background: #facc15; color: #1f2937;
  font-size: 9px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1.5px solid #ffffff;
  box-shadow: 0 0 0 1px #cbd5e1;
}
.swimlane-legend .legend-badge.iesos { background: #16a34a; color: #ffffff; }
