.jdc-luna-launcher,
.jdc-luna {
  --luna-navy: #0c2036;
  --luna-ink: #122b44;
  --luna-muted: #4a6475;
  --luna-accent: #65e7e2;
  --luna-paper: #f0f8fa;
  --luna-line: #d3e2e8;
  font: 400 1rem/1.5 system-ui, sans-serif;
}

.jdc-luna-launcher {
  position: fixed;
  inset: auto max(1.25rem, env(safe-area-inset-right)) max(1.25rem, env(safe-area-inset-bottom)) auto;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  min-height: 3.5rem;
  padding: .3rem 1.15rem .3rem .35rem;
  border: 1px solid #53b6bc;
  border-radius: 2rem;
  box-shadow: 0 8px 26px #061b4345, inset 0 1px #ffffff18;
  background: var(--luna-navy);
  color: #e9ffff;
  font-weight: 710;
  cursor: pointer;
}

.jdc-luna-launcher:hover { border-color: var(--luna-accent); background: #15334b; }
.jdc-luna-launcher__portrait {
  display: block;
  width: 2.7rem;
  height: 2.7rem;
  border: 1px solid #65e7e2b3;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 27%;
}

.jdc-luna-launcher__copy {
  display: grid;
  justify-items: start;
  line-height: 1.15;
}

.jdc-luna-launcher__title {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
}

.jdc-luna-launcher__credit {
  margin-top: .22rem;
  color: #b6c1ca;
  font-size: .69rem;
  font-weight: 450;
}

.jdc-luna,
.jdc-luna * { box-sizing: border-box; }

.jdc-luna {
  width: min(calc(100vw - 2rem), 60rem);
  max-width: none;
  max-height: calc(100dvh - 2rem);
  margin: auto;
  padding: 0;
  overflow: auto;
  overscroll-behavior: contain;
  color: var(--luna-ink);
  background: #fbfdfd;
  border: 1px solid #c9dde4;
  border-radius: 1.4rem;
  box-shadow: 0 24px 92px #040e24a1;
}

.jdc-luna::backdrop { background: #06172ada; }
.jdc-luna [hidden] { display: none !important; }
.jdc-luna h2,
.jdc-luna p { margin: 0; }

.jdc-luna__layout {
  position: relative;
  display: grid;
  grid-template-columns: clamp(13rem, 27vw, 16rem) minmax(0, 1fr);
  min-height: min(36rem, calc(100dvh - 2rem));
}

.jdc-luna__identity {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  align-self: stretch;
  overflow: hidden;
  color: #f2ffff;
  background: radial-gradient(ellipse at 9% 85%, #1b4d60 0, transparent 70%), var(--luna-navy);
}

.jdc-luna__portrait {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: center;
  background: #17364b;
}

.jdc-luna__identity-copy {
  align-self: stretch;
  padding: 1.5rem clamp(1.15rem, 2.75vw, 1.95rem);
  border-top: 1px solid #65e7e247;
}

.jdc-luna__identity h2 {
  color: inherit;
  font: 700 clamp(1.8rem, 3.2vw, 2.6rem)/1.05 system-ui, sans-serif;
  letter-spacing: -.06em;
}

.jdc-luna__identity p { margin-top: .5rem; color: #b6dadd; font-size: .9rem; }

.jdc-luna__identity-title {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem .7rem;
  align-items: center;
}

.jdc-luna__presence {
  display: inline-flex;
  gap: .35rem;
  align-items: center;
  color: #c3ced4;
  font-size: .75rem;
  font-weight: 650;
}

.jdc-luna__presence::before {
  content: '';
  width: .44rem;
  height: .44rem;
  border-radius: 50%;
  background: currentColor;
}

.jdc-luna__presence.is-online { color: #8cebc0; }

.jdc-luna__workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
  --luna-gutter: clamp(1rem, 2.5vw, 1.8rem);
}

.jdc-luna__header {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  min-height: 4.4rem;
  padding: .75rem var(--luna-gutter);
  border-bottom: 1px solid var(--luna-line);
  background: #f4fafb;
}

.jdc-luna__header-controls {
  display: flex;
  flex: none;
  align-items: center;
  gap: .45rem;
  margin-left: auto;
}

.jdc-luna__header-controls .jdc-luna__voice {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: .35rem .75rem;
  border: 1px solid #debabc;
  border-radius: .85rem;
  background: #fff1f1;
  color: #872e37;
  font-size: .85rem;
  font-weight: 660;
}

.jdc-luna__header-controls .jdc-luna__voice:hover {
  background: #ffe3e4;
  border-color: #c9777d;
}

.jdc-luna__mode {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  color: #245461;
  font-size: .875rem;
  font-weight: 660;
}

.jdc-luna__icon {
  display: inline-block;
  flex: none;
  width: 1.15rem;
  height: 1.15rem;
  vertical-align: middle;
}

.jdc-luna button { font: inherit; cursor: pointer; }
.jdc-luna :focus-visible,
.jdc-luna-launcher:focus-visible { outline: 2px solid #03878b; outline-offset: 3px; }

.jdc-luna__close {
  display: inline-grid;
  place-items: center;
  flex: none;
  min-width: 2.75rem;
  min-height: 2.75rem;
  margin-left: auto;
  padding: 0;
  border: 1px solid #b6ced7;
  border-radius: 50%;
  background: #fff;
  color: var(--luna-ink);
}

.jdc-luna__close:hover { border-color: #85b6be; background: #e8f6f7; }

.jdc-luna__chat {
  display: flex;
  flex: 1 0 auto;
  flex-direction: column;
  padding: 1.15rem var(--luna-gutter) .85rem;
}

.jdc-luna__messages {
  display: flex;
  flex: 1 0 auto;
  flex-direction: column;
  gap: .65rem;
  min-height: min(13rem, 22dvh);
  max-height: min(43dvh, 23rem);
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  padding: 2px 3px 4px;
}

.jdc-luna__message {
  width: fit-content;
  max-width: min(92%, 34rem);
  padding: .8rem 1rem;
  border: 1px solid #dfecef;
  border-radius: .45rem 1rem 1rem;
  background: var(--luna-paper);
  overflow-wrap: anywhere;
}

.jdc-luna__message--user {
  align-self: flex-end;
  border-color: #c9eeeb;
  border-radius: 1rem .45rem 1rem 1rem;
  background: #ddfaf7;
}

.jdc-luna__message a,
.jdc-luna__actions a,
.jdc-luna__fallback {
  color: #005e68;
  text-decoration: underline;
  text-underline-offset: .15em;
}

.jdc-luna__message a { display: block; margin-top: .45rem; }
.jdc-luna__actions a,
.jdc-luna__fallback { font-size: .875rem; }

.jdc-luna__suggestions,
.jdc-luna__actions {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
  align-items: center;
}

.jdc-luna__suggestions { margin: .9rem 0 0; }
.jdc-luna__suggestions:empty { display: none; }

.jdc-luna__suggestions button,
.jdc-luna__actions button,
.jdc-luna__back,
.jdc-luna__composer button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: .4rem .9rem;
  border: 1px solid #bfd7df;
  border-radius: .85rem;
  background: white;
  color: #164453;
  font-size: .875rem;
  font-weight: 660;
  text-align: center;
}

.jdc-luna__suggestions button:hover,
.jdc-luna__actions button:hover,
.jdc-luna__back:hover { border-color: #7fb9bf; background: #eaf8f8; }

.jdc-luna__composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .5rem;
  margin-top: .9rem;
}

.jdc-luna__composer input {
  min-width: 0;
  min-height: 3rem;
  padding: .6rem .9rem;
  border: 1px solid #a9c5d0;
  border-radius: .85rem;
  background: white;
  color: var(--luna-ink);
  font: inherit;
}

.jdc-luna__composer input::placeholder { color: #527080; }

.jdc-luna__composer button,
.jdc-luna__actions .jdc-luna__calendar {
  border-color: #96e5e0;
  background: #a8f3ee;
  color: var(--luna-navy);
}

.jdc-luna__composer button:hover,
.jdc-luna__actions .jdc-luna__calendar:hover,
.jdc-luna__actions .jdc-luna__voice[aria-pressed="true"] { border-color: #59c7c6; background: var(--luna-accent); }

.jdc-luna button:disabled { opacity: .63; cursor: default; }
.jdc-luna__actions { padding: .75rem var(--luna-gutter) .5rem; border-top: 1px solid var(--luna-line); }
.jdc-luna__actions a { display: inline-flex; gap: .35rem; align-items: center; min-height: 2.75rem; }

.jdc-luna .jdc-luna__status,
.jdc-luna .jdc-luna__privacy {
  padding: .2rem var(--luna-gutter);
  color: var(--luna-muted);
  font-size: .82rem;
}

.jdc-luna .jdc-luna__status:empty { display: none; }
.jdc-luna .jdc-luna__credit {
  padding: .2rem var(--luna-gutter) 1rem;
  color: #596873;
  font-size: .75rem;
}

.jdc-luna__booking { padding: .8rem var(--luna-gutter); }
.jdc-luna__booking-head { display: flex; flex-wrap: wrap; align-items: center; gap: .65rem; color: var(--luna-muted); font-size: .875rem; }
.jdc-luna .jdc-luna__booking-status { margin-top: .65rem; padding: .6rem .8rem; border-radius: .55rem; background: var(--luna-paper); }

.jdc-luna__booking iframe {
  display: block;
  width: 100%;
  height: clamp(25rem, 61dvh, 52rem);
  margin-top: .65rem;
  border: 1px solid var(--luna-line);
  border-radius: .8rem;
  background: white;
}

.jdc-luna__voice-stage {
  display: grid;
  gap: .8rem;
  padding: clamp(.85rem, 3vw, 1.65rem) var(--luna-gutter) 1rem;
}

.jdc-luna__voice-display {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: .75rem;
  min-height: 16rem;
  padding: 1.45rem 1rem;
  overflow: hidden;
  text-align: center;
  color: #edfdfc;
  background: radial-gradient(ellipse at 50% 35%, #174e5b 0, transparent 63%), #10283d;
  border: 1px solid #335968;
  border-radius: 1rem;
  --luna-signal: #78ebdf;
}

.jdc-luna__voice-display[data-phase="hearing"] { --luna-signal: #88caff; }
.jdc-luna__voice-display[data-phase="thinking"],
.jdc-luna__voice-display[data-phase="searching"],
.jdc-luna__voice-display[data-phase="searching_booking"] { --luna-signal: #b1c9ff; }

.jdc-luna .jdc-luna__voice-kind {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  color: #bdd9df;
  font-size: .85rem;
}

.jdc-luna__wave {
  display: block;
  width: min(100%, 22rem);
  height: 5rem;
  fill: none;
}

.jdc-luna__wave-guide { stroke: #8de4e458; stroke-dasharray: 2 6; }
.jdc-luna__wave-signal {
  stroke: var(--luna-signal);
  stroke-linecap: round;
  stroke-width: 2;
  transition: stroke .18s ease;
}

.jdc-luna .jdc-luna__voice-phase {
  font-size: clamp(1.05rem, 3vw, 1.35rem);
  font-weight: 690;
  line-height: 1.25;
  text-wrap: balance;
}

.jdc-luna__voice-toolbar,
.jdc-luna__draft-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem .75rem;
  align-items: center;
}

.jdc-luna__voice-toolbar button,
.jdc-luna__draft button {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  min-height: 2.75rem;
  padding: .36rem .75rem;
  border: 1px solid #a9cad2;
  border-radius: .65rem;
  color: var(--luna-ink);
  background: white;
  font: 650 .85rem/1.35 system-ui, sans-serif;
}

.jdc-luna__voice-toolbar button[aria-pressed="true"] { background: #e6eff1; }

.jdc-luna__voice-reference,
.jdc-luna__draft {
  padding: .75rem .85rem;
  border: 1px solid var(--luna-line);
  border-radius: .75rem;
  background: var(--luna-paper);
}

.jdc-luna__voice-reference {
  display: flex;
  align-items: center;
  gap: .75rem;
  color: var(--luna-muted);
  font-size: .85rem;
}

.jdc-luna__voice-reference a { color: #1c596c; font-weight: 680; }
.jdc-luna__actions .jdc-luna__voice { border-color: #467e83; background: #113b4c; color: white; }
.jdc-luna__actions .jdc-luna__voice:hover { background: #20586b; }
.jdc-luna__actions .jdc-luna__voice[aria-pressed="true"] { background: #e9f4f5; color: var(--luna-ink); }

.jdc-luna__draft { margin: 0 var(--luna-gutter) .8rem; }
.jdc-luna__draft h3 { margin: 0 0 .65rem; font: 680 1rem/1.25 system-ui, sans-serif; }
.jdc-luna__draft-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 9.5rem), 1fr));
  gap: .55rem;
  margin-bottom: .65rem;
}

.jdc-luna__draft-fields label { display: grid; gap: .22rem; color: var(--luna-muted); font-size: .85rem; }
.jdc-luna__draft-fields input {
  min-width: 0;
  min-height: 2.75rem;
  padding: .35rem .5rem;
  color: var(--luna-ink);
  background: white;
  border: 1px solid #a9cad2;
  border-radius: .5rem;
  font: 400 1rem/1.35 system-ui, sans-serif;
}

.jdc-luna__draft [type="submit"] { background: #a8f3ee; border-color: #96e5e0; }

@media (max-width: 43rem) {
  .jdc-luna__voice-display { min-height: 12.5rem; gap: .45rem; }
  .jdc-luna__wave { height: 3.75rem; }
}

@media (prefers-reduced-motion: reduce) {
  .jdc-luna__wave-signal { transition: none; }
}

.jdc-luna__fallback { display: inline-block; margin-top: .5rem; }
.jdc-luna:has(.jdc-luna__booking:not([hidden])) { width: min(calc(100vw - 2rem), 74rem); }
.jdc-luna:has(.jdc-luna__booking:not([hidden])) .jdc-luna__layout {
  grid-template-columns: clamp(8.5rem, 15vw, 11rem) minmax(0, 1fr);
}
.jdc-luna:has(.jdc-luna__booking:not([hidden])) .jdc-luna__identity-copy { padding-inline: 1rem; }

@media (max-width: 43rem) {
  .jdc-luna,
  .jdc-luna:has(.jdc-luna__booking:not([hidden])) {
    width: calc(100vw - 1rem);
    max-height: calc(100dvh - 1rem);
    margin-bottom: max(.45rem, env(safe-area-inset-bottom));
    border-radius: 1.05rem;
  }

  .jdc-luna__layout,
  .jdc-luna:has(.jdc-luna__booking:not([hidden])) .jdc-luna__layout {
    display: block;
    min-height: 0;
  }

  .jdc-luna__identity {
    display: grid;
    flex: 1;
    grid-template-columns: 4.9rem minmax(0, 1fr);
    gap: .8rem;
    align-items: center;
    min-height: 0;
    padding: .6rem 0 .6rem .7rem;
    background: transparent;
  }

  .jdc-luna__portrait { border-radius: .65rem; }
  .jdc-luna__identity-copy,
  .jdc-luna:has(.jdc-luna__booking:not([hidden])) .jdc-luna__identity-copy { padding: 0; border-top: 0; }
  .jdc-luna__identity h2 { font-size: 1.65rem; }
  .jdc-luna__identity p { margin-top: .28rem; font-size: .8rem; }
  .jdc-luna__workspace { --luna-gutter: .8rem; }
  .jdc-luna__header {
    gap: .55rem;
    min-height: 0;
    padding: 0 .65rem 0 0;
    border: 0;
    background: radial-gradient(ellipse at 9% 85%, #1b4d60 0, transparent 70%), var(--luna-navy);
  }

  .jdc-luna__header-controls { align-self: flex-start; margin: .65rem 0 0 auto; }
  .jdc-luna__header-controls .jdc-luna__voice { justify-content: center; padding-inline: .5rem; }
  .jdc-luna__mode { display: none; }
  .jdc-luna__close { border-color: #598597; background: #15344b; color: white; }
  .jdc-luna__close:hover { background: #245065; }
  .jdc-luna__chat { padding-top: .75rem; }
  .jdc-luna__messages { min-height: min(8rem, 17dvh); max-height: 32dvh; }
  .jdc-luna__message { padding: .65rem .8rem; }
  .jdc-luna__booking iframe { height: clamp(26rem, 63dvh, 52rem); }
}

@media (max-width: 31rem) {
  .jdc-luna__header-controls .jdc-luna__voice span { display: none; }
}

@media (max-width: 25rem) {
  .jdc-luna-launcher {
    inset: auto max(.65rem, env(safe-area-inset-right)) max(.65rem, env(safe-area-inset-bottom)) auto;
  }
  .jdc-luna__composer button { padding-inline: .65rem; }
}

.jd-dock:has(.jdc-luna-launcher--dock) {
  width: min(21rem, calc(100% - max(24px, 2 * env(safe-area-inset-left), 2 * env(safe-area-inset-right))));
}

.jd-dock__pill:has(.jdc-luna-launcher--dock) {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .2rem;
}

.jd-dock .jdc-luna-launcher--dock {
  position: static;
  inset: auto;
  display: grid;
  grid-template-columns: auto auto;
  grid-template-areas: "portrait title" "credit credit";
  justify-content: center;
  align-content: center;
  gap: 1px .24rem;
  min-width: 0;
  min-height: 2.75rem;
  padding: .12rem .24rem;
  border: 1px solid #3d7880;
  box-shadow: none;
  background: #113b4c;
  color: #e9ffff;
}

.jd-dock .jdc-luna-launcher--dock:hover { background: #1b5363; }
.jdc-luna-launcher--dock .jdc-luna-launcher__portrait { grid-area: portrait; width: 1.3rem; height: 1.3rem; }
.jdc-luna-launcher--dock .jdc-luna-launcher__copy { display: contents; }
.jdc-luna-launcher--dock .jdc-luna-launcher__title { grid-area: title; gap: .22rem; font-size: .79rem; }
.jdc-luna-launcher--dock .jdc-luna-launcher__credit { grid-area: credit; margin: 0; font-size: .52rem; line-height: 1.1; }
.jdc-luna-launcher--dock .jdc-luna__presence { font-size: .5rem; gap: .17rem; }
.jdc-luna-launcher--dock .jdc-luna__presence::before { width: .32rem; height: .32rem; }

@media (max-width: 23rem) {
  .jd-dock:has(.jdc-luna-launcher--dock) .jd-dock__trigger,
  .jd-dock:has(.jdc-luna-launcher--dock) .jd-dock__menu { gap: .3rem; padding-inline: .25rem; }
}

@media (max-height: 34rem) {
  .jdc-luna__header { min-height: 0; }
  .jdc-luna__chat { padding-block: .5rem; }
  .jdc-luna__messages { min-height: 0; max-height: 24dvh; }
  .jdc-luna__suggestions, .jdc-luna__composer { margin-top: .55rem; }
  .jdc-luna__voice-stage { padding-block: .5rem; gap: .5rem; }
  .jdc-luna__voice-display { min-height: 0; padding-block: .55rem; gap: .3rem; }
  .jdc-luna__wave { height: 3rem; }
  .jdc-luna__booking iframe { height: max(10rem, calc(100dvh - 10.65rem)); }
}

@media (max-width: 43rem) and (max-height: 34rem) {
  .jdc-luna__identity {
    grid-template-columns: 3.5rem minmax(0, 1fr);
    gap: .5rem;
    padding-block: .45rem;
  }
  .jdc-luna__identity h2 { font-size: 1.35rem; }
  .jdc-luna__header-controls { margin-top: .45rem; }
}
