/* The cinematic backdrop stays with the selected B scene. This layer replaces its product UI. */
.r18-dialogue,
.r18-clarification,
.r18-deployment {
  --r18-ui-ink: #fbf3e9;
  --r18-ui-muted: #c7bccd;
  --r18-ui-accent: #efca8d;
  --r18-ui-base: #28212d;
  --r18-ui-panel: #322936;
  --r18-ui-layer: #3b303e;
  --r18-ui-line: #564653;
  font-family: Golos, GolosCurrency, Arial, sans-serif;
}

[data-theme="light"] :is(.r18-dialogue, .r18-clarification, .r18-deployment) {
  --r18-ui-ink: #302439;
  --r18-ui-muted: #625765;
  --r18-ui-accent: #67437c;
  --r18-ui-base: #fffaf2;
  --r18-ui-panel: #f5eff6;
  --r18-ui-layer: #eee6f0;
  --r18-ui-line: #d8cada;
}

:is(.r18-dialogue, .r18-clarification, .r18-deployment) svg {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.55;
}

#ai .r18-dialogue {
  --r18-ui-hero-band: color-mix(in srgb, var(--r18-ui-base) 90%, transparent);
  width: min(560px, 100%);
  margin: 0;
  padding: 17px;
  display: grid;
  gap: 11px;
  color: var(--r18-ui-ink);
  background: var(--r18-ui-hero-band);
  border-radius: 18px;
}

#ai .r18-dialogue p,
#ai .r18-dialogue dl,
#ai .r18-dialogue dd { margin: 0; color: inherit; }

.r18-dialogue-request {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  align-items: baseline;
  gap: 10px;
  padding: 10px 13px;
  background: var(--r18-ui-layer);
  border-radius: 8px;
}

.r18-dialogue-request span,
.r18-dialogue-author,
.r18-dialogue-confirm span { color: var(--r18-ui-muted); font-size: 13px; line-height: 1.4; }

#ai .r18-dialogue-request p,
#ai .r18-dialogue-confirm p { font-size: 15px; line-height: 1.4; }

.r18-dialogue-author { display: block; padding: 2px 2px 7px; }

.r18-dialogue-report {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(130px, .56fr);
  align-items: end;
  gap: 9px 20px;
  padding: 15px 17px 12px;
  border-radius: 10px;
  background: var(--r18-ui-panel);
}

.r18-dialogue-total span { display: block; color: var(--r18-ui-muted); font-size: 14px; line-height: 1.4; }
.r18-dialogue-total strong {
  display: block;
  color: var(--r18-ui-ink);
  font-size: clamp(28px, 3.2vw, 42px);
  font-weight: 560;
  letter-spacing: -.04em;
  line-height: 1.12;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.r18-dialogue-breakdown > div { display: flex; justify-content: space-between; gap: 7px; font-size: 13px; line-height: 1.5; }
.r18-dialogue-breakdown dt { color: var(--r18-ui-muted); }
.r18-dialogue-breakdown dd { font-weight: 550; font-variant-numeric: tabular-nums; }
.r18-dialogue-bar { grid-column: 1 / -1; display: grid; grid-template-columns: 3fr 2fr; gap: 3px; height: 5px; overflow: hidden; border-radius: 4px; }
.r18-dialogue-bar i:first-child { background: var(--r18-ui-accent); }
.r18-dialogue-bar i:last-child { background: color-mix(in srgb, var(--r18-ui-accent) 35%, var(--r18-ui-panel)); }
.r18-dialogue-file { grid-column: 1 / -1; display: flex; align-items: center; gap: 7px; color: var(--r18-ui-muted); font-size: 13px; }
.r18-dialogue-file svg { width: 17px; height: 17px; }
.r18-dialogue-confirm { display: flex; align-items: center; gap: 11px; padding: 0 12px 2px; color: var(--r18-ui-ink); }
.r18-dialogue-confirm svg, .r18-dialogue-confirm strong { color: var(--r18-ui-accent); }

.r9-benefit-story:has(> .r18-clarification) {
  display: flex !important;
  flex-direction: column;
  align-items: stretch !important;
  gap: clamp(22px, 3vw, 40px) !important;
}

.r9-benefit-story:has(> .r18-clarification) > .r9-benefit-copy { order: -1; }

.r18-clarification {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 1fr);
  min-width: 0;
  width: 100%;
  margin: 0;
  overflow: hidden;
  color: var(--r18-ui-ink);
  background: var(--r18-ui-base);
  border-radius: 18px;
}

.r18-clarification > section {
  min-width: 0;
  padding: clamp(21px, 3.5vw, 48px);
  margin: 0;
  background: none;
}

.r18-clarification .r18-clarification-result { background: var(--r18-ui-panel); }
.r18-clarification h4 { margin: 0 0 22px; color: var(--r18-ui-ink); font-size: clamp(21px, 2.3vw, 29px); font-weight: 525; line-height: 1.2; letter-spacing: -.03em; }
.r18-clarification p { margin: 0; color: var(--r18-ui-ink); font-size: clamp(15px, 1.2vw, 17px); line-height: 1.5; }
.r18-clarification [data-r18-at][aria-hidden="true"] { visibility: hidden; }
.r18-clarification p.r18-clarification-check {
  margin: 13px 0 0 44px;
  color: var(--r18-ui-muted);
  font-size: 14px;
}
.r18-clarification p.r18-clarification-memory {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 17px 0 0 44px;
  padding: 9px 10px;
  border-radius: 7px;
  background: var(--r18-ui-layer);
  color: var(--r18-ui-accent);
  font-size: 15px;
}
.r18-clarification-memory svg { width: 18px; height: 18px; }
.r18-message { display: grid; grid-template-columns: 32px minmax(0, 1fr); align-items: start; gap: 12px; margin-top: 17px; }
.r18-message-avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--r18-ui-layer); font-size: 14px; line-height: 1; }
.r18-message-avatar svg { width: 16px; height: 16px; color: var(--r18-ui-accent); }
.r18-message-author { display: block; margin-bottom: 2px; color: var(--r18-ui-muted); font-size: 13px; line-height: 1.4; }
.r18-message-agent > div { padding-left: 10px; border-left: 2px solid var(--r18-ui-accent); }
.r18-clarification-fields { margin: 19px 0 0; }
.r18-clarification-fields > div { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding-block: 10px; border-top: 1px solid var(--r18-ui-line); }
.r18-clarification-fields dt { color: var(--r18-ui-muted); font-size: 14px; }
.r18-clarification-fields dd { margin: 0; text-align: right; font-size: 17px; font-weight: 530; }
.r18-clarification p.r18-clarification-applied { display: flex; align-items: flex-start; gap: 8px; margin: 13px 0 0; color: var(--r18-ui-accent); font-size: 13px; line-height: 1.4; }
.r18-clarification-applied svg { width: 17px; height: 17px; }

.r17k-modes.r18-deployment { gap: clamp(20px, 2.6vw, 38px); }
.r18-deployment > .r17k-mode {
  display: grid;
  grid-template: auto auto 1fr / minmax(0, 1fr);
  gap: 0;
  align-content: start;
  min-width: 0;
  overflow: hidden;
  border-radius: 18px;
  background: var(--r18-ui-base);
  color: var(--r18-ui-ink);
}

.r18-deployment .r17k-mode-heading { grid-area: auto; min-height: 143px; padding: 25px 23px 19px; margin: 0; }
.r18-deployment .r17k-mode-heading h3 { color: var(--r18-ui-ink); font-size: clamp(21px, 1.9vw, 28px); line-height: 1.14; margin: 0 0 9px; }
.r18-deployment .r17k-mode-heading p { color: var(--r18-ui-muted); font-size: 15px; max-width: none; }

.r18-deployment-map {
  --r18-ui-map-inset: 15px;
  --r18-ui-map-pad: 14px;
  display: grid;
  grid-template-rows: minmax(226px, 1fr) auto auto;
  min-width: 0;
  min-height: 358px;
  margin: 0 var(--r18-ui-map-inset);
}

.r18-map-company {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 15px var(--r18-ui-map-pad);
  border: 1px solid var(--r18-ui-line);
  border-radius: 11px;
  background: var(--r18-ui-layer);
}

.r18-map-local .r18-map-company { grid-row: 1 / -1; }
.r18-map-boundary { display: flex; align-items: center; gap: 6px; margin: 0 0 15px; font-size: 12px; line-height: 1.3; color: var(--r18-ui-muted); }
.r18-map-boundary svg { width: 14px; height: 14px; }

.r18-map-chain {
  position: relative;
  display: grid;
  align-content: start;
  gap: 10px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.r18-map-local .r18-map-chain {
  flex: 1;
  grid-template-rows: repeat(3, 1fr);
  align-content: stretch;
}

.r18-map-chain::before {
  content: "";
  position: absolute;
  inset: 23px auto 23px 15.5px;
  width: 1px;
  background: var(--r18-ui-accent);
  opacity: .46;
}

.r18-map-local .r18-map-chain::before {
  top: 17%;
  bottom: 17%;
}

.r18-map-node {
  position: relative;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  min-width: 0;
  min-height: 47px;
}
.r18-map-node svg { width: 32px; height: 32px; padding: 6px; border-radius: 7px; color: var(--r18-ui-accent); background: var(--r18-ui-base); }
.r18-map-node strong { display: block; color: var(--r18-ui-ink); font-size: 16px; line-height: 1.3; font-weight: 540; }
.r18-map-node span { display: block; color: var(--r18-ui-muted); font-size: 13px; line-height: 1.35; margin-top: 2px; }
.r18-map-complete strong { color: var(--r18-ui-accent); }
.r18-map-complete svg {
  background: color-mix(in srgb, var(--r18-ui-accent) 15%, var(--r18-ui-base));
}

.r18-map-mask {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 4px 0 7px 43px;
  padding: 4px 7px;
  border-left: 2px solid var(--r18-ui-accent);
  color: var(--r18-ui-muted);
  background: var(--r18-ui-panel);
  font-size: 12px;
  line-height: 1.3;
}
.r18-map-mask svg, .r18-map-receipt svg { width: 14px; height: 14px; }

.r18-map-receipt {
  align-self: flex-end;
  display: flex;
  flex-direction: row-reverse;
  gap: 5px;
  align-items: center;
  margin: auto 0 0;
  padding: 8px 8px 0 0;
  color: var(--r18-ui-accent);
  font-size: 12px;
  line-height: 1.3;
}

.r18-map-crossing {
  display: grid;
  grid-template-columns: minmax(0, 1.14fr) minmax(0, 1fr);
  min-height: 65px;
  color: var(--r18-ui-muted);
}

.r18-map-crossing span {
  position: relative;
  display: flex;
  align-items: center;
  padding: 8px 4px 8px calc(var(--r18-ui-map-pad) + 29px);
  font-size: 12px;
  line-height: 1.25;
}

.r18-map-crossing span::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(var(--r18-ui-map-pad) + 15.5px);
  width: 1px;
  background: currentColor;
  opacity: .65;
}
.r18-map-crossing span::after {
  content: "";
  position: absolute;
  left: calc(var(--r18-ui-map-pad) + 12.5px);
  top: calc(50% - 4px);
  width: 7px;
  height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
}
.r18-map-outbound { color: var(--r18-ui-accent); }
.r18-map-outbound::after { transform: rotate(45deg); }
.r18-map-crossing .r18-map-inbound {
  justify-content: flex-end;
  padding-inline: 4px calc(var(--r18-ui-map-pad) + 29px);
  text-align: right;
}
.r18-map-crossing .r18-map-inbound::before {
  left: auto;
  right: calc(var(--r18-ui-map-pad) + 15.5px);
  background: none;
  border-left: 1px dashed currentColor;
}
.r18-map-inbound::after {
  left: auto;
  right: calc(var(--r18-ui-map-pad) + 12.5px);
  transform: rotate(225deg);
}

.r18-map-terminal {
  display: grid;
  align-items: center;
  min-height: 67px;
  padding: 10px var(--r18-ui-map-pad);
  border-radius: 9px;
  background: var(--r18-ui-panel);
}

.r18-deployment .r17k-work { grid-area: auto; align-self: start; border: 0; margin: 0; padding: 21px 23px 25px; }
.r18-deployment .r17k-work h4 { color: var(--r18-ui-ink); }
.r18-deployment .r17k-work p { color: var(--r18-ui-muted); max-width: none; }

@media (max-width: 1000px) {
  .r17k-modes.r18-deployment { grid-template-columns: minmax(0, 1fr); gap: 26px; }
  .r18-deployment > .r17k-mode { grid-template-columns: minmax(0,.8fr) minmax(0, 1fr); }
  .r18-deployment .r17k-mode-heading { grid-area: 1 / 1; min-height: 0; }
  .r18-deployment-map { grid-area: 1 / 2 / 3 / 3; margin-block: var(--r18-ui-map-inset); }
  .r18-deployment .r17k-work { grid-area: 2 / 1; padding-top: 6px; }
}

@media (max-width: 650px) {
  #ai .r18-dialogue { padding: 12px; gap: 10px; }
  .r18-dialogue-request { gap: 7px; padding-inline: 9px; }
  .r18-dialogue-report { grid-template-columns: minmax(0, 1fr) minmax(88px, .52fr); gap: 8px 12px; padding-inline: 11px; }
  .r18-dialogue-total span { font-size: 13px; }
  .r18-dialogue-total strong { font-size: clamp(22px, 7vw, 34px); }
  .r18-clarification { grid-template-columns: minmax(0, 1fr); }
  .r18-clarification h4 { margin-bottom: 16px; }
  .r18-deployment > .r17k-mode { grid-template-columns: minmax(0, 1fr); }
  .r18-deployment :is(.r17k-mode-heading, .r18-deployment-map, .r17k-work) { grid-area: auto; }
  .r18-deployment-map { margin-block: 0; }
  .r18-deployment .r17k-work { padding-top: 19px; }
}
