:root {
  /* Light pink / blush theme (main + participant sites) */
  --bg: #fef5f8;
  --panel: #ffffff;
  --panel2: #fdeef4;
  --text: #3d2a32;
  --muted: #7d5f6c;
  --accent: #c94f7c;
  --accent2: #a8557a;
  --danger: #c62828;
  --border: rgba(61, 42, 50, 0.14);
  --shadow: rgba(61, 42, 50, 0.08);
  --shadow-strong: rgba(61, 42, 50, 0.12);
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto,
    Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background: var(--bg);
  color: var(--text);
}

#app {
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* Participant survey: main fills space below topbar so the left column can scroll within the viewport */
body[data-survey-mode="participant"] #app > main.layout {
  flex: 1 1 auto;
  min-height: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  box-shadow: 0 1px 0 var(--shadow);
}

.topbar__title {
  font-weight: 700;
  letter-spacing: 0.2px;
}

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

/* Participant left panel: flex column — profile stays visible, lower block scrolls */
body[data-survey-mode="participant"] .layout > aside.panel,
body[data-survey-mode="conductor"] .layout > aside.panel {
  display: flex;
  flex-direction: column;
  align-self: stretch;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

body[data-survey-mode="participant"] .participantProfileCard {
  flex-shrink: 0;
}

/* Scrollable region: raw materials + supply chain (fills space below profile card) */
.participantAsideContent {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 4px;
}

/* Participant: company / role / products summary above raw materials */
.participantProfileCard {
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.participantProfileRow {
  margin-bottom: 12px;
}

.participantProfileRow:last-child {
  margin-bottom: 0;
}

.participantProfileRow__label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 6px 0;
}

.participantProfileProductsHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.participantProfileHeaderActions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.participantProfileRow__label--inline {
  margin-bottom: 0;
}

.participantProfileProductsEditBtn {
  flex-shrink: 0;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
}

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

.participantProfileProductList__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(241, 245, 249, 0.95);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.participantProfileProductList__item--other {
  background: rgba(30, 41, 59, 0.06);
}

.participantProfileProductList__item--textOnly .participantProfileProductList__label {
  flex: 1 1 auto;
  width: 100%;
}

.participantProfileProductList__icon {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  object-fit: contain;
}

.participantProfileProductList__iconFallback {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: #1e293b;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
}

.participantProfileProductList__label {
  flex: 1;
  min-width: 0;
  line-height: 1.35;
}

.participantProfileProductsEmpty {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

.pill {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
}

.layout {
  flex: 1;
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 12px;
  padding: 12px;
  min-height: 0;
}

.panel {
  background: linear-gradient(180deg, #ffffff, #fff8fb);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  padding: 12px;
  min-height: 0;
  box-shadow: 0 4px 24px var(--shadow);
}

.tabs {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.tab {
  text-align: left;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel2);
  color: var(--text);
  cursor: pointer;
}

.tab.is-active {
  border-color: rgba(201, 79, 124, 0.55);
  box-shadow: 0 0 0 3px rgba(201, 79, 124, 0.15);
  background: #ffffff;
}

.step {
  max-height: calc(100vh - 170px);
  overflow: auto;
  padding-right: 4px;
}

/* Must win over later rules like .conductorLogin { display: flex } */
.is-hidden {
  display: none !important;
}

.panel__h2 {
  margin: 10px 0 6px 0;
  font-size: 16px;
}

.panel__hint {
  margin: 0 0 10px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.3;
}

.buttonRow {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.modeBtn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
}

.modeBtn__icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.modeBtn.is-muted {
  color: var(--muted);
}

.routeControls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.primaryBtn {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(201, 79, 124, 0.45);
  background: rgba(201, 79, 124, 0.12);
  color: var(--text);
  cursor: pointer;
  font-weight: 650;
}

.primaryBtn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.dangerBtn {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(198, 40, 40, 0.45);
  background: rgba(198, 40, 40, 0.1);
  color: var(--text);
  cursor: pointer;
  font-weight: 650;
}

.dangerBtn:hover {
  border-color: rgba(198, 40, 40, 0.65);
  background: rgba(198, 40, 40, 0.14);
}

.dangerBtn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ghostBtn {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text);
  cursor: pointer;
}

.ghostBtn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.panelActions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
}

.miniStat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border: 1px solid var(--border);
  background: var(--panel2);
  border-radius: 10px;
  padding: 10px;
  min-width: 150px;
}

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

.miniStat__value {
  font-size: 18px;
  font-weight: 800;
}

.panel__note {
  margin-top: 10px;
  border: 1px dashed rgba(61, 42, 50, 0.2);
  background: var(--panel2);
  padding: 10px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.35;
}

.fileRow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.fileLabel {
  color: var(--muted);
  font-size: 13px;
  min-width: 200px;
}

.exportSummary {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.exportSummary__item {
  border: 1px solid var(--border);
  background: var(--panel2);
  border-radius: 10px;
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.exportSummary__value {
  font-weight: 800;
}

.mapWrap {
  position: relative;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  min-height: 0;
  box-shadow: 0 4px 24px var(--shadow);
}

/* Cursor-following hint on map only: prompt to mark workplace (participant); position via JS */
.mapCompanyHint {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 415;
  max-width: min(320px, calc(100% - 24px));
  padding: 8px 14px;
  text-align: center;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0.02em;
  color: var(--text);
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(201, 79, 124, 0.35);
  border-radius: 10px;
  box-shadow: 0 4px 18px rgba(61, 42, 50, 0.12);
  pointer-events: none;
  box-sizing: border-box;
}

.mapCompanyHint--rawOrigin {
  border-color: rgba(20, 184, 166, 0.42);
}

/* Participant: “Currently Editing” banner while drawing a supply-chain leg on the map */
.supplyChainRouteEditBanner {
  position: absolute;
  left: 50%;
  top: 12px;
  transform: translateX(-50%);
  z-index: 416;
  max-width: min(520px, calc(100% - 24px));
  pointer-events: none;
  box-sizing: border-box;
}

.supplyChainRouteEditBanner__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px 16px;
  padding: 10px 18px;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(148, 163, 184, 0.55);
  border-radius: 999px;
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.1);
}

.supplyChainRouteEditBanner__title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.02em;
}

.supplyChainRouteEditBanner__diagram {
  display: flex;
  align-items: center;
  gap: 10px;
}

.supplyChainRouteEditBanner__node {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border-radius: 50%;
  background: #92400e;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.supplyChainRouteEditBanner__leg {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 72px;
}

.supplyChainRouteEditBanner__mode {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  text-align: center;
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.supplyChainRouteEditBanner__arrowLine {
  display: block;
  width: 100%;
  min-width: 48px;
  max-width: 120px;
  height: 2px;
  background: #0f172a;
  border-radius: 1px;
  position: relative;
}

.supplyChainRouteEditBanner__arrowLine::after {
  content: "";
  position: absolute;
  right: -1px;
  top: 50%;
  transform: translateY(-50%);
  border: 5px solid transparent;
  border-left: 9px solid #0f172a;
}

/* Cursor-following hint while marking the route */
.supplyChainRouteCursorHint {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 418;
  padding: 7px 14px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text);
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(148, 163, 184, 0.65);
  border-radius: 999px;
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.14);
  pointer-events: none;
  box-sizing: border-box;
}

/* Participant: confirm / cancel before a location is saved (√ / × above the pin) */
.leaflet-div-icon.locationPendingConfirm-marker {
  background: transparent !important;
  border: none !important;
}

.locationPendingConfirm {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 52px;
  pointer-events: auto;
}

.locationPendingConfirm__row {
  display: flex;
  gap: 4px;
  justify-content: center;
}

.locationPendingConfirm__btn {
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  color: var(--text);
  cursor: pointer;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 1px 4px rgba(61, 42, 50, 0.12);
}

.locationPendingConfirm__btn:hover {
  background: #f8fafc;
}

.locationPendingConfirm__btn--cancel {
  color: #b91c1c;
  border-color: rgba(185, 28, 28, 0.35);
}

.locationPendingConfirm__dot {
  width: 12px;
  height: 12px;
  margin-top: 4px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.locationPendingConfirm__dot--icon {
  width: 28px;
  height: 28px;
  background: #fff;
  border-color: #ccc;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mapWrap.map-gate-open::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 410;
  background: rgba(15, 23, 42, 0.18);
  pointer-events: auto;
}

body[data-map-gate-open="1"] .layout .panel {
  pointer-events: none;
  opacity: 0.88;
  transition: opacity 0.15s ease;
}

#map {
  width: 100%;
  height: 100%;
  min-height: 640px;
}

.mapHint {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 415;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 12.5px;
  max-width: min(70%, calc(100% - 200px));
  box-shadow: 0 4px 16px var(--shadow);
}

/* Participant: skip originating-location map step */
.rawMaterialOriginMapSkipWrap {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 415;
  max-width: calc(100% - 24px);
}

.rawMaterialOriginMapSkipBtn {
  font-size: 12.5px;
  font-weight: 600;
  white-space: normal;
  text-align: center;
  line-height: 1.35;
  max-width: 220px;
}

.goodsGate__option--skip {
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px dashed rgba(148, 163, 184, 0.65);
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .step {
    max-height: unset;
  }
  #map {
    min-height: 520px;
  }
}

/* Participant gate (index): hide survey until valid link params */
html:not(.participant-token-ok) #participantGate {
  display: flex;
}

html.participant-token-ok #participantGate {
  display: none;
}

/* Participant welcome gate (index): show welcome after link is valid, before survey loads */
html.participant-token-ok:not(.participant-welcome-ok) #welcomeGate {
  display: flex;
}

html:not(.participant-token-ok) #welcomeGate {
  display: none;
}

html.participant-welcome-ok #welcomeGate {
  display: none;
}

/* Industry questionnaire (participant index): compact dialog over map panel */
#industryGate.industryGate--floating {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 420;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  background: transparent;
  pointer-events: none;
}

#industryGate.industryGate--floating.is-open,
#roleGate.roleGate--floating.is-open,
#goodsGate.goodsGate--floating.is-open,
#rawMaterialsGate.rawMaterialsGate--floating.is-open,
#participantProductsGate.rawMaterialsGate--floating.is-open,
#rawMaterialSupplyChainIntroGate.rawMaterialSupplyChainIntroGate--floating.is-open,
#rawMaterialSupplyChainDiagramGate.rawMaterialSupplyChainDiagramGate--floating.is-open,
#rawMaterialTripFrequencyGate.rawMaterialTripFrequencyGate--floating.is-open,
#rawMaterialOriginGate.rawMaterialOriginGate--floating.is-open {
  display: flex;
}

#roleGate.roleGate--floating,
#goodsGate.goodsGate--floating,
#rawMaterialsGate.rawMaterialsGate--floating,
#participantProductsGate.rawMaterialsGate--floating,
#rawMaterialSupplyChainIntroGate.rawMaterialSupplyChainIntroGate--floating,
#rawMaterialSupplyChainDiagramGate.rawMaterialSupplyChainDiagramGate--floating,
#rawMaterialTripFrequencyGate.rawMaterialTripFrequencyGate--floating,
#rawMaterialOriginGate.rawMaterialOriginGate--floating {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 420;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  background: transparent;
  pointer-events: none;
}

#industryGate.industryGate--floating .industryGate__card,
#roleGate.roleGate--floating .roleGate__card,
#goodsGate.goodsGate--floating .goodsGate__card,
#rawMaterialsGate.rawMaterialsGate--floating .rawMaterialsGate__card,
#participantProductsGate.rawMaterialsGate--floating .rawMaterialsGate__card,
#rawMaterialSupplyChainIntroGate.rawMaterialSupplyChainIntroGate--floating
  .rawMaterialSupplyChainIntroGate__card,
#rawMaterialSupplyChainDiagramGate.rawMaterialSupplyChainDiagramGate--floating .supplyChainDiagramGate__card,
#rawMaterialTripFrequencyGate.rawMaterialTripFrequencyGate--floating .rawMaterialTripFrequencyGate__card,
#rawMaterialOriginGate.rawMaterialOriginGate--floating .rawMaterialOriginGate__card {
  max-width: 420px;
  width: 100%;
  padding: 18px 20px;
  pointer-events: auto;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.18);
}

#rawMaterialSupplyChainDiagramGate.rawMaterialSupplyChainDiagramGate--floating .supplyChainDiagramGate__card {
  max-width: min(560px, calc(100vw - 32px));
  max-height: min(88vh, 900px);
  overflow-y: auto;
}

.supplyChainDiagramGate__title {
  margin: 0 0 8px;
  font-size: 1.45rem;
  line-height: 1.3;
  font-weight: 700;
  color: var(--text);
  text-align: center;
}

.supplyChainDiagramGate__intro {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--muted);
}

.rawMaterialTripFrequencyGate__title {
  margin: 0 0 8px;
  font-size: 1.35rem;
  line-height: 1.3;
  font-weight: 700;
  color: var(--text);
  text-align: center;
}

.rawMaterialTripFrequencyGate__intro {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

.rawMaterialTripFrequencyGate__inputs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}

.rawMaterialTripFrequencyGate__count {
  width: 88px;
  flex: 0 0 auto;
}

.rawMaterialTripFrequencyGate__period {
  flex: 1 1 120px;
  min-width: 120px;
}

.rawMaterialTripFrequencyGate__mid {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}

.supplyChainDiagram__tripFreqRow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}

.supplyChainDiagram__tripFreqInput {
  width: 72px;
  flex: 0 0 auto;
}

.supplyChainDiagram__tripFreqMid {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.supplyChainDiagram__rmBadge {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(51, 65, 85, 0.12);
  color: var(--text);
  font-weight: 700;
  font-size: 13px;
}

.supplyChainRouteConfirmWrap {
  background: transparent !important;
  border: none !important;
  overflow: visible !important;
}

.supplyChainRouteConfirmStack {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  width: max-content;
  max-width: min(300px, 90vw);
  box-sizing: border-box;
}

/* Top: label + √ only (card) */
.supplyChainRouteConfirm {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.15);
  font-size: 13px;
  color: var(--text);
}

.supplyChainRouteConfirm__text {
  line-height: 1.25;
  font-weight: 600;
  flex: 1;
  min-width: 0;
}

.supplyChainRouteConfirm__btn {
  flex-shrink: 0;
  min-width: 36px;
  height: 36px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  background: #0d9488;
}

.supplyChainRouteConfirm__btn:hover {
  filter: brightness(1.06);
}

/* Bottom: − + caption in a second card (matches top white panel) */
.supplyChainRouteUndoRow {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.15);
}

.supplyChainRouteUndoRow__btn {
  flex-shrink: 0;
  min-width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
  font-weight: 700;
  color: #334155;
  background: #f1f5f9;
  border: 1px solid var(--border);
}

.supplyChainRouteUndoRow__btn:hover {
  background: #e2e8f0;
}

.supplyChainRouteUndoRow__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.25;
  user-select: none;
}

.supplyChainDiagramMount {
  margin-top: 4px;
}

/* Participant Step 1: raw materials + products + detail (supply chain diagram) */
.participantLeftEmpty {
  min-height: 120px;
}

.participantLeftShell {
  margin-bottom: 12px;
}

.participantLeftSection {
  margin-bottom: 14px;
}

.participantLeftSection__h {
  margin: 0 0 8px 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.participantPillRow {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.participantPillRow--products .participantPill--muted {
  font-style: italic;
  color: var(--muted);
}

.participantPill {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(45, 212, 191, 0.45);
  background: rgba(204, 251, 241, 0.65);
  color: #0f172a;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.participantPill:hover {
  filter: brightness(0.98);
}

.participantPill.is-active {
  background: #1e293b;
  border-color: #1e293b;
  color: #fff;
}

.participantLeftDetail {
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.participantLeftDetail__h {
  margin: 0 0 8px 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.participantLeftDetail__label {
  font-weight: 700;
  margin-right: 6px;
}

.participantLeftDetail__name {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 8px;
  background: rgba(51, 65, 85, 0.12);
  font-weight: 700;
  font-size: 13px;
}

.participantLeftDetailPlaceholder {
  margin: 0 0 10px 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.35;
}

.participantDiagramSaveRow {
  margin-top: 10px;
}

/* Diagram scrolls with the left column (see .participantAsideContent); avoid nested short viewport */
.supplyChainDiagramMount--left {
  margin-top: 4px;
  max-height: none;
  overflow-x: hidden;
  overflow-y: visible;
  padding-right: 2px;
}

.supplyChainDiagramMount--sidebarReadonly .supplyChainDiagram__select:disabled,
.supplyChainDiagramMount--sidebarReadonly .goodsGate__input[readonly] {
  background: rgba(248, 250, 252, 0.95);
  color: var(--text);
  cursor: default;
}

.supplyChainDiagram__flow {
  position: relative;
  margin: 0;
  padding: 4px 0 8px;
  /* Stack content above the segment line (line is positioned in JS from A to C). */
  z-index: 0;
}

.supplyChainDiagram__track {
  display: none;
  position: absolute;
  width: 4px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 2px;
  background: #15803d;
  pointer-events: none;
  z-index: 0;
  box-sizing: border-box;
}

.supplyChainDiagram__flowInner {
  --sc-track-width: 4px;
  --sc-track-pad-left: 16px;
  /* Horizontal distance from content start to center of the green track (padding + half track). */
  --sc-line-center-x: calc(-1 * (var(--sc-track-pad-left) + var(--sc-track-width) / 2));
  position: relative;
  z-index: 1;
  margin-left: 14px;
  padding-left: var(--sc-track-pad-left);
}

.supplyChainDiagram__row {
  position: relative;
  margin-bottom: 16px;
}

.supplyChainDiagram__row--transport .supplyChainDiagram__trackPad {
  display: none;
}

.supplyChainDiagram__nodeDot {
  position: absolute;
  /* Center of circle on the vertical track (matches --sc-line-center-x above). */
  left: var(--sc-line-center-x);
  top: 4px;
  transform: translateX(-50%);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(145deg, #a16207, #78350f);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  z-index: 2;
}

.supplyChainDiagram__nodeDot--b {
  background: linear-gradient(145deg, #a16207, #78350f);
}

.supplyChainDiagram__fieldLabel {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 4px;
}

.supplyChainDiagram__fieldLabel--withIcon {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.supplyChainDiagram__fieldLabel--withIcon .supplyChainDiagram__icon--destination {
  width: 24px;
  height: 24px;
}

.supplyChainDiagram__originMapRow {
  margin-top: 8px;
}

.supplyChainDiagram__originMapBtn {
  font-size: 12px;
  font-weight: 600;
}

.supplyChainDiagram__transportLabelBar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.supplyChainDiagram__fieldLabel--bar {
  margin-bottom: 0;
  flex: 1;
  min-width: 0;
}

.supplyChainDiagram__redrawRouteBtn {
  flex-shrink: 0;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.supplyChainDiagram__select {
  width: 100%;
  max-width: 100%;
}

.supplyChainDiagram__readonly {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(241, 245, 249, 0.9);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
}

.supplyChainDiagram__icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.supplyChainDiagram__hint {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.supplyChainDiagram__inlineActions {
  margin-top: 8px;
  display: flex;
  justify-content: flex-end;
}

.supplyChainDiagram__iconBtn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #f8fafc;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  color: var(--text);
}

.supplyChainDiagram__iconBtn:hover {
  background: #fff;
}

.supplyChainDiagram__iconBtn--minus {
  color: #b91c1c;
  border-color: rgba(185, 28, 28, 0.35);
}

.industryGate__title {
  margin: 0 0 8px;
  font-size: 1.08rem;
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--text);
}

.industryGate__intro {
  font-size: 13px;
  line-height: 1.5;
}

.industryGate__label {
  display: block;
  margin-top: 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.industryGate__input {
  width: 100%;
  box-sizing: border-box;
  margin-top: 6px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font: inherit;
  color: var(--text);
  background: #fff;
}

.industryGate__input:focus {
  outline: none;
  border-color: rgba(201, 79, 124, 0.55);
  box-shadow: 0 0 0 3px rgba(201, 79, 124, 0.15);
}

.roleGate__title {
  margin: 0 0 8px;
  font-size: 1.08rem;
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--text);
}

.roleGate__intro {
  font-size: 13px;
  line-height: 1.5;
  margin: 0 0 12px;
  color: var(--muted);
}

.roleGate__fieldset {
  border: none;
  margin: 0;
  padding: 0;
}

.roleGate__legend {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.roleGate__option {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  font-size: 14px;
  cursor: pointer;
  color: var(--text);
}

.roleGate__option input {
  width: auto;
  margin: 0;
  accent-color: #c94f7c;
}

.roleOtherWrap {
  margin-top: 4px;
}

.roleGate__label {
  display: block;
  margin-top: 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.roleGate__input {
  width: 100%;
  box-sizing: border-box;
  margin-top: 6px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font: inherit;
  color: var(--text);
  background: #fff;
}

.roleGate__input:focus {
  outline: none;
  border-color: rgba(201, 79, 124, 0.55);
  box-shadow: 0 0 0 3px rgba(201, 79, 124, 0.15);
}

.goodsGate__title {
  margin: 0 0 8px;
  font-size: 1.08rem;
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--text);
}

.goodsGate__intro {
  font-size: 13px;
  line-height: 1.5;
  margin: 0 0 12px;
  color: var(--muted);
}

.goodsGate__fieldset {
  border: none;
  margin: 0;
  padding: 0;
}

.goodsGate__legend {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.goodsGate__option {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  font-size: 14px;
  cursor: pointer;
  color: var(--text);
}

.goodsGate__option input {
  width: auto;
  margin: 0;
  accent-color: #c94f7c;
}

.goodsGate__icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.goodsOtherWrap {
  margin-top: 4px;
}

.goodsGate__label {
  display: block;
  margin-top: 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.goodsGate__input {
  width: 100%;
  box-sizing: border-box;
  margin-top: 6px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font: inherit;
  color: var(--text);
  background: #fff;
}

.goodsGate__input:focus {
  outline: none;
  border-color: rgba(201, 79, 124, 0.55);
  box-shadow: 0 0 0 3px rgba(201, 79, 124, 0.15);
}

.rawMaterialsGate__title {
  margin: 0 0 8px;
  font-size: 1.08rem;
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--text);
}

.rawMaterialsGate__intro {
  font-size: 13px;
  line-height: 1.5;
  margin: 0 0 12px;
  color: var(--muted);
}

.rawMaterialsList {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
  max-height: min(52vh, 360px);
  overflow-y: auto;
}

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

.rawMaterialsRow .goodsGate__input {
  flex: 1;
  min-width: 0;
  margin-top: 0;
}

.rawMaterialsRow__remove {
  flex-shrink: 0;
  padding: 8px 10px;
  font-size: 12px;
}

.rawMaterialsAddBtn {
  margin-bottom: 8px;
}

.rawMaterialSupplyChainIntroGate__title {
  margin: 0 0 16px;
  font-size: 1.05rem;
  line-height: 1.45;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text);
}

.rawMaterialOriginGate__title {
  margin: 0 0 8px;
  font-size: 1.08rem;
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--text);
}

.rawMaterialOriginGate__intro {
  font-size: 13px;
  line-height: 1.5;
  margin: 0 0 12px;
  color: var(--muted);
}

/* Participant index only: hide main #app until ?participant=&token= are present */
html:not(.participant-token-ok) body[data-survey-mode="participant"] #app {
  display: none;
}

.participant-token-ok:not(.participant-welcome-ok) body[data-survey-mode="participant"] #app {
  display: none;
}

.participantGate {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(1200px 700px at 20% 0%, rgba(201, 79, 124, 0.14), rgba(254, 245, 248, 0) 58%),
    radial-gradient(900px 600px at 80% 100%, rgba(232, 160, 191, 0.2), rgba(254, 245, 248, 0) 55%),
    var(--bg);
  box-sizing: border-box;
}

.participantGate__card {
  max-width: 520px;
  padding: 24px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #ffffff, #fff8fb);
  box-shadow: 0 16px 48px var(--shadow-strong);
}

.participantGate__h1 {
  margin: 0 0 12px;
  font-size: 1.45rem;
  line-height: 1.25;
  letter-spacing: 0.2px;
}

.participantGate__p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.participantGate__code {
  font-size: 0.85em;
  word-break: break-all;
}

.participantGate__actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

/* Welcome page tweaks */
.welcomeGate__card {
  max-width: 720px;
  padding: 28px;
}

.welcomeGate__p {
  font-size: 14px;
  line-height: 1.65;
}

/* Conductor index.html */
.conductorLogin {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
}

.conductorLogin__card {
  width: 100%;
  max-width: 420px;
  padding: 24px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel);
}

.conductorLogin__h1 {
  margin: 0 0 8px;
  font-size: 1.25rem;
}

.conductorLogin__p {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.conductorLogin__label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--muted);
}

.conductorLogin__input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  margin-bottom: 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel2);
  color: var(--text);
  font: inherit;
}

.conductorLogin__btn {
  width: 100%;
}

.conductorLogin__status {
  margin: 12px 0 0;
  min-height: 1.35em;
  font-size: 13px;
  line-height: 1.4;
  color: var(--danger);
}

.conductorLogin__status.conductorLogin__status--ok {
  color: var(--accent2);
}

.conductorWorkspace {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.conductorWorkspace #app {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* Conductor: scrollable participant summary; export block pinned to bottom of sidebar */
.conductorParticipantMirror {
  flex: 1 1 auto;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body[data-survey-mode="conductor"] .conductorParticipantMirror .participantProfileCard {
  flex-shrink: 0;
}

body[data-survey-mode="conductor"] .conductorParticipantMirror .participantAsideContent {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 4px;
}

.conductorExportBlock {
  flex-shrink: 0;
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.conductorExportBlock .panel__h2 {
  margin-top: 0;
}

.conductorToolbar {
  flex-shrink: 0;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #ffffff, #fff5f9);
  box-shadow: 0 4px 20px var(--shadow);
}

.conductorToolbar__row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.conductorToolbar__h2 {
  margin: 0;
  font-size: 1rem;
}

.conductorToolbar__hint {
  font-size: 13px;
  color: var(--accent2);
}

.conductorToolbar__industry {
  display: block;
  width: 100%;
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
}

.conductorToolbar__create {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.conductorToolbar__input {
  flex: 1;
  min-width: 200px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel2);
  color: var(--text);
  font: inherit;
}

.shareUrlOutput {
  width: 100%;
  max-width: 720px;
  box-sizing: border-box;
  padding: 10px;
  margin-bottom: 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  font: 12px/1.4 ui-monospace, monospace;
  resize: vertical;
}

.participantFilterBar {
  margin-bottom: 8px;
}

.participantFilterToggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.participantFilterToggle__chevron {
  display: inline-block;
  transition: transform 0.15s ease;
  transform: rotate(0deg);
  color: var(--accent);
}

.participantFilterToggle--open .participantFilterToggle__chevron {
  transform: rotate(90deg);
}

.participantFilterPanel {
  padding-top: 4px;
  margin-bottom: 4px;
}

.participantPicker {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 8px 12px;
  align-items: center;
  margin-bottom: 8px;
}

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

.participantPicker__input {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel2);
  color: var(--text);
  font: inherit;
}

.participantPicker__input:focus {
  outline: none;
  border-color: rgba(201, 79, 124, 0.45);
  box-shadow: 0 0 0 3px rgba(201, 79, 124, 0.12);
}

.participantPicker__hint {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.45;
}

.participantList {
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: 260px;
  overflow: auto;
}

.participantList--with-delete li {
  margin-bottom: 6px;
}

.participantRow {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.participantRow__select {
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel2);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.participantRow__select:hover {
  border-color: var(--accent);
}

.participantRow__select.is-active {
  border-color: var(--accent2);
  box-shadow: 0 0 0 1px var(--accent2);
}

.participantRow__delete {
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
}

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

.participantList__btn {
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel2);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.participantList__btn:hover {
  border-color: var(--accent);
}

.participantList__btn.is-active {
  border-color: var(--accent2);
  box-shadow: 0 0 0 1px var(--accent2);
}

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

