/* Chat widget: a corner bubble that opens a short Sofia intro and hands off to Messenger.
   Self-contained: every token has a fallback so pages without elevated.css (audit.html) render it too. */
.dltc {
  --dltc-ink: var(--ink, #0A0F1A);
  --dltc-mute: var(--ink-mute, #6B7A99);
  --dltc-line: var(--paper-line, #E1E5ED);
  --dltc-dark: var(--obsidian, #0A0F1A);
  --dltc-mint: var(--mint, #00D4AA);
  --dltc-mint-bright: var(--mint-bright, #00E8BC);
  --dltc-font: var(--font-body, 'Geist', system-ui, -apple-system, sans-serif);
  --dltc-mono: var(--font-mono, 'Geist Mono', 'SF Mono', Menlo, Consolas, monospace);
  --dltc-ease: var(--ease-ui, cubic-bezier(0.23, 1, 0.32, 1));
  --dltc-bottom: 16px;
  position: fixed;
  right: 16px;
  bottom: calc(var(--dltc-bottom) + env(safe-area-inset-bottom));
  z-index: 90;
  font-family: var(--dltc-font);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}
.dltc--above-bar { --dltc-bottom: 96px; }

.dltc__launch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: var(--dltc-dark);
  cursor: pointer;
  box-shadow: 0 0 0 1px var(--dltc-line), 0 10px 26px -8px rgba(10, 15, 26, 0.35);
  position: relative;
  transition: transform 160ms var(--dltc-ease), box-shadow 200ms ease, background-color 200ms ease;
}
.dltc__launch:active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) {
  .dltc__launch:hover { transform: translateY(-2px); box-shadow: 0 0 0 1px var(--dltc-mint), 0 14px 32px -8px rgba(10, 15, 26, 0.4); }
  .dltc__launch:hover:active { transform: translateY(-2px) scale(0.97); }
}
.dltc__launch:focus-visible { outline: 2px solid var(--dltc-mint); outline-offset: 3px; }
.dltc__launch svg { width: 22px; height: 22px; flex: none; }
.dltc__launch-icon path:last-child { fill: var(--dltc-mint); }
.dltc__launch-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* Chat icon and X are stacked; they cross-scale instead of swapping */
.dltc__launch-icon, .dltc__launch-close { position: absolute; inset: 0; margin: auto; transition: opacity 150ms var(--dltc-ease), transform 150ms var(--dltc-ease); }
.dltc__launch-close { opacity: 0; transform: scale(0.8) rotate(-45deg); }
.dltc.is-open .dltc__launch-icon { opacity: 0; transform: scale(0.8); }
.dltc.is-open .dltc__launch-close { opacity: 1; transform: none; }

.dltc__panel {
  width: min(360px, calc(100vw - 32px));
  background: #fff;
  border: 1px solid var(--dltc-line);
  border-radius: 20px;
  box-shadow: 0 1px 0 rgba(10, 15, 26, 0.04), 0 28px 56px -24px rgba(10, 15, 26, 0.38);
  overflow: hidden;
  transform-origin: bottom right;
  transition: opacity 200ms var(--dltc-ease), transform 200ms var(--dltc-ease);
}
/* Entry from display:none (browsers without @starting-style simply show it) */
@starting-style { .dltc__panel { opacity: 0; transform: translateY(8px) scale(0.98); } }
.dltc__panel[hidden] { display: none; }

.dltc__top { display: flex; align-items: center; gap: 12px; padding: 14px 14px 14px 16px; border-bottom: 1px solid var(--dltc-line); }
.dltc__avatar { width: 36px; height: 36px; flex: none; border-radius: 50%; background: var(--dltc-dark); color: var(--dltc-mint); display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.dltc__who { line-height: 1.25; min-width: 0; }
.dltc__name { margin: 0; font-weight: 600; font-size: 15px; color: var(--dltc-ink); }
.dltc__status { margin: 0; font-size: 12px; color: var(--dltc-mute); display: flex; align-items: center; gap: 6px; }
.dltc__status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #1FB57A; }
.dltc__langs { margin-left: auto; display: inline-flex; border: 1px solid var(--dltc-line); border-radius: 999px; padding: 2px; }
.dltc__langs button { border: 0; background: transparent; color: var(--dltc-mute); font: 600 11px/1 var(--dltc-mono); letter-spacing: 0.08em; padding: 5px 8px; border-radius: 999px; cursor: pointer; }
.dltc__langs button[aria-pressed="true"] { background: var(--dltc-dark); color: #F7F8FA; }
.dltc__langs button:focus-visible, .dltc__x:focus-visible { outline: 2px solid var(--dltc-mint); outline-offset: 2px; }
.dltc__x { border: 0; background: transparent; color: var(--dltc-mute); width: 30px; height: 30px; border-radius: 50%; cursor: pointer; display: grid; place-items: center; flex: none; }
.dltc__x:hover { background: #EEF1F5; color: var(--dltc-ink); }

.dltc__body { padding: 16px; display: flex; flex-direction: column; gap: 8px; background: #fff; }
.dltc__bubble { margin: 0; max-width: 88%; padding: 10px 13px; border-radius: 16px; border-bottom-left-radius: 5px; background: #EEF1F5; color: var(--dltc-ink); font-size: 14px; line-height: 1.45; }

.dltc__foot { padding: 4px 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.dltc__go { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 12px 16px; border-radius: 12px; background: var(--dltc-mint); color: var(--dltc-dark); font-weight: 600; font-size: 15px; text-decoration: none; transition: background 0.15s; }
.dltc__go:hover { background: var(--dltc-mint-bright); }
.dltc__go:focus-visible { outline: 2px solid var(--dltc-dark); outline-offset: 2px; }
.dltc__go svg { width: 18px; height: 18px; }
.dltc__note { margin: 0; font-size: 12px; line-height: 1.4; color: var(--dltc-mute); text-align: center; }
.dltc__note a { color: var(--dltc-ink); text-decoration: underline; text-underline-offset: 2px; }

@media (max-width: 760px) {
  .dltc { right: 16px; }
  .dltc__launch { width: 48px; height: 48px; }
}

/* Phones: the widget becomes the bottom bar (primary action + chat), never a bubble over the text */
.dltc__bar-go { display: none; }
@media (max-width: 760px) {
  .dltc.dltc--bar { left: 0; right: 0; bottom: 0; flex-direction: row; align-items: center; gap: 12px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--dltc-dark); }
  .dltc--bar .dltc__bar-go { display: flex; flex: 1; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 16px; background: var(--dltc-mint); color: var(--dltc-dark); font: 600 16px/1 var(--dltc-font); text-decoration: none; transition: transform 160ms var(--dltc-ease), background-color 200ms ease; }
  .dltc--bar .dltc__bar-go svg { width: 18px; height: 18px; }
  .dltc--bar .dltc__bar-go:active { transform: scale(0.97); background: var(--dltc-mint-bright); }
  .dltc--bar .dltc__bar-go:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
  .dltc--bar .dltc__panel { position: absolute; right: 16px; bottom: calc(100% + 12px); }
  .dltc.dltc--bar { transition: transform 240ms var(--dltc-ease); }
  .dltc.dltc--bar.dltc--away { transform: translateY(110%); }
}
@media (max-width: 760px) and (prefers-reduced-motion: reduce) {
  .dltc.dltc--bar { transition: opacity 200ms ease; }
  .dltc.dltc--bar.dltc--away { transform: translateY(110%); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .dltc__launch, .dltc__launch-icon, .dltc__launch-close, .dltc__panel { transition-property: opacity, box-shadow, background-color !important; }
  .dltc__launch:hover, .dltc__launch:active, .dltc__launch:hover:active { transform: none; }
  @starting-style { .dltc__panel { transform: none; } }
}
@media print { .dltc { display: none; } }
