/* CITYENGINE_CHAT_CLEANUP_R1
   Presentation only. Load after the approved compact chat assets where
   possible. Readiness-specific selectors also win when old homepage styles
   appear later in the document. No shell, iframe, or composer size changes. */

#ce-city-ask-dialog-r2 {
  --ce-cleanup1-shell: 1;
}
body.embedded {
  --ce-cleanup1-inner: 1;
}

/* Keep the approved footer budgets: 49px on ordinary touch, 33px on short
   touch/mobile viewports, and 35px on fine-pointer desktop. Borders are
   included in each control's height, not added outside that budget. */
#ce-city-ask-dialog-r2[data-ce-density-ready="2"][data-ce-cleanup-ready="1"] .ceask-r2-links {
  padding-top: 2px;
  padding-bottom: calc(2px + env(safe-area-inset-bottom));
}
#ce-city-ask-dialog-r2[data-ce-density-ready="2"][data-ce-cleanup-ready="1"] .ceask-r2-links > a.ce-cleanup1-link {
  box-sizing: border-box;
  justify-content: center;
  min-height: 44px;
  padding: 5px 8px;
  border: 1px solid #b8cbe8;
  border-radius: 6px;
  background: #fff;
  color: #2457b5;
  font-size: 11px;
  line-height: 1.4;
  text-decoration: none;
}
#ce-city-ask-dialog-r2[data-ce-density-ready="2"][data-ce-cleanup-ready="1"] .ceask-r2-links > a.ce-cleanup1-link:hover {
  background: #edf3ff;
  text-decoration: none;
}
#ce-city-ask-dialog-r2[data-ce-density-ready="2"][data-ce-cleanup-ready="1"] .ceask-r2-links > a.ce-cleanup1-link:focus-visible {
  outline: 2px solid #237bd0;
  outline-offset: -3px;
}
@media (max-height: 450px) {
  #ce-city-ask-dialog-r2[data-ce-density-ready="2"][data-ce-cleanup-ready="1"] .ceask-r2-links {
    padding-top: 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
  #ce-city-ask-dialog-r2[data-ce-density-ready="2"][data-ce-cleanup-ready="1"] .ceask-r2-links > a.ce-cleanup1-link {
    min-height: 32px;
  }
}
@media (min-width: 601px) and (hover: hover) and (pointer: fine) {
  #ce-city-ask-dialog-r2[data-ce-density-ready="2"][data-ce-cleanup-ready="1"] .ceask-r2-links {
    padding-top: 3px;
    padding-bottom: calc(3px + env(safe-area-inset-bottom));
  }
  #ce-city-ask-dialog-r2[data-ce-density-ready="2"][data-ce-cleanup-ready="1"] .ceask-r2-links > a.ce-cleanup1-link {
    min-height: 28px;
    padding: 3px 8px;
  }
}

/* Three equal action controls. 44px is a minimum, so wrapped labels can grow
   at narrow widths or increased text size without clipping any words. */
body.embedded.ce-density2-ready.ce-cleanup1-ready:not(.lead-open):not(.widget-managed) .next-steps {
  gap: 4px;
  padding: 4px 8px;
}
body.embedded.ce-density2-ready.ce-cleanup1-ready:not(.lead-open):not(.widget-managed) .next-steps > .text-button {
  min-width: 0;
  min-height: 44px;
  height: auto;
  padding: 5px 4px;
  border-width: 1px;
  border-style: solid;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.3;
  white-space: normal;
  overflow-wrap: anywhere;
}
body.embedded.ce-density2-ready.ce-cleanup1-ready:not(.lead-open):not(.widget-managed) .next-steps > .human-action,
body.embedded.ce-density2-ready.ce-cleanup1-ready:not(.lead-open):not(.widget-managed) .next-steps > .onboarding-action {
  border-color: #b8cbe8;
}
body.embedded.ce-density2-ready.ce-cleanup1-ready #human-open > span[data-ce-cleanup-followup="1"] {
  display: none;
}

/* Clear remains the original button, including its app-controlled disabled
   state. The small outline makes its action affordance explicit. */
body.embedded.ce-density2-ready.ce-cleanup1-ready .panel-head > #clear {
  min-height: 44px;
  padding: 4px 8px;
  border: 1px solid #b8cbe8;
  border-radius: 6px;
  background: #fff;
  color: #365571;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
}
body.embedded.ce-density2-ready.ce-cleanup1-ready .panel-head > #clear:focus-visible,
body.embedded.ce-density2-ready.ce-cleanup1-ready main > details.privacy > summary.ce-cleanup1-privacy:focus-visible {
  outline: 2px solid #237bd0;
  outline-offset: -3px;
}

/* Hide only the identified opening welcome's visual speaker heading. Keep
   the existing sender text in the accessibility tree and preserve the log. */
body.embedded.ce-density2-ready.ce-cleanup1-ready #chat > .assistant-message.ce-cleanup1-welcome > .speaker {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
body.embedded.ce-density2-ready.ce-cleanup1-ready #chat > .assistant-message.ce-cleanup1-welcome > p:first-of-type {
  margin-top: 0;
}

/* These two exact footer links duplicate or distract from the public modal
   actions. Other anchors, privacy text, and the full-page footer are untouched. */
body.embedded.ce-density2-ready.ce-cleanup1-ready main > footer .ce-cleanup1-hide-link {
  display: none;
}
body.embedded.ce-density2-ready.ce-cleanup1-ready main > footer.ce-cleanup1-footer {
  min-height: 0;
  margin-top: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-top: 0;
}

/* The existing details/summary element retains its native disclosure and
   keyboard behavior. The CSS triangle is decorative, without generated text. */
body.embedded.ce-density2-ready.ce-cleanup1-ready:not(.lead-open) main > details.privacy > summary.ce-cleanup1-privacy {
  display: flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  max-width: 100%;
  min-height: 44px;
  padding: 5px 8px;
  border: 1px solid #b8cbe8;
  border-radius: 6px;
  background: #fff;
  color: #365571;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
  list-style: none;
}
body.embedded.ce-density2-ready.ce-cleanup1-ready main > details.privacy > summary.ce-cleanup1-privacy::-webkit-details-marker {
  display: none;
}
body.embedded.ce-density2-ready.ce-cleanup1-ready main > details.privacy > summary.ce-cleanup1-privacy::before {
  content: "";
  flex: 0 0 auto;
  width: 0;
  height: 0;
  border-top: 3px solid transparent;
  border-bottom: 3px solid transparent;
  border-left: 4px solid currentColor;
}
body.embedded.ce-density2-ready.ce-cleanup1-ready main > details.privacy[open] > summary.ce-cleanup1-privacy::before {
  transform: rotate(90deg);
}
body.embedded.ce-density2-ready.ce-cleanup1-ready:not(.lead-open) .request-shortcut > #request-open {
  min-height: 44px;
}
@media (hover: hover) and (pointer: fine) {
  body.embedded.ce-density2-ready.ce-cleanup1-ready .panel-head > #clear,
  body.embedded.ce-density2-ready.ce-cleanup1-ready:not(.lead-open) main > details.privacy > summary.ce-cleanup1-privacy {
    min-height: 28px;
  }
  body.embedded.ce-density2-ready.ce-cleanup1-ready:not(.lead-open) .request-shortcut > #request-open {
    min-height: 32px;
  }
}
@media (forced-colors: active) {
  #ce-city-ask-dialog-r2[data-ce-density-ready="2"][data-ce-cleanup-ready="1"] .ceask-r2-links > a.ce-cleanup1-link,
  body.embedded.ce-density2-ready.ce-cleanup1-ready .panel-head > #clear,
  body.embedded.ce-density2-ready.ce-cleanup1-ready main > details.privacy > summary.ce-cleanup1-privacy {
    border-color: ButtonText;
    background: ButtonFace;
    color: ButtonText;
  }
}
