.oga {
  --oga-accent: #735cfc;
  --oga-ink: #172033;
  --oga-muted: #626a78;
  --oga-line: #e5e7ef;
  --oga-soft: #f5f4ff;
  --oga-surface: #fff;
  --oga-danger: #b42318;
  position: fixed;
  z-index: 999990;
  bottom: max(22px, env(safe-area-inset-bottom));
  color: var(--oga-ink);
  font-family: "DM Sans", "Plus Jakarta Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.45;
  text-align: left;
  isolation: isolate;
}

.oga--right { right: max(22px, env(safe-area-inset-right)); }
.oga--left { left: max(22px, env(safe-area-inset-left)); }
.oga *, .oga *::before, .oga *::after { box-sizing: border-box; }
.oga button, .oga input, .oga textarea, .oga select { font: inherit; }
.oga button { text-transform: none; letter-spacing: normal; }
.oga [hidden] { display: none !important; }
.oga .screen-reader-text {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.oga__launcher {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 7px 17px 7px 8px;
  color: #fff;
  background: var(--oga-ink);
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 999px;
  box-shadow: 0 14px 34px rgba(23, 32, 51, .24);
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease;
}
.oga__launcher:hover { transform: translateY(-2px); box-shadow: 0 18px 42px rgba(23, 32, 51, .3); }
.oga__launcher:focus-visible, .oga button:focus-visible, .oga input:focus-visible, .oga textarea:focus-visible, .oga select:focus-visible, .oga a:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--oga-accent) 45%, white);
  outline-offset: 3px;
}
.oga__launcher-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--oga-accent);
}
.oga__launcher-mark svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.oga__launcher-label { font-weight: 700; font-size: 14px; white-space: nowrap; }

.oga__panel {
  position: absolute;
  bottom: 68px;
  width: min(400px, calc(100vw - 32px));
  height: min(680px, calc(100vh - 118px));
  min-height: 480px;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  overflow: hidden;
  color: var(--oga-ink);
  background: var(--oga-surface);
  border: 1px solid rgba(34, 46, 72, .13);
  border-radius: 22px;
  box-shadow: 0 28px 70px rgba(20, 28, 45, .24), 0 2px 8px rgba(20, 28, 45, .08);
  transform-origin: bottom right;
  animation: oga-open .24s cubic-bezier(.2,.8,.2,1) both;
}
.oga--right .oga__panel { right: 0; }
.oga--left .oga__panel { left: 0; transform-origin: bottom left; }

@keyframes oga-open { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }

.oga__header {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 12px 16px;
  border-bottom: 1px solid var(--oga-line);
}
.oga__identity { min-width: 0; display: flex; align-items: center; gap: 10px; }
.oga__identity h2 { margin: 0; color: var(--oga-ink); font: 750 15px/1.25 "Plus Jakarta Sans", "DM Sans", system-ui, sans-serif; letter-spacing: -.01em; }
.oga__identity p { display: flex; align-items: center; gap: 6px; margin: 3px 0 0; color: var(--oga-muted); font-size: 11px; }
.oga__identity p span { width: 6px; height: 6px; background: #2ebd78; border-radius: 50%; box-shadow: 0 0 0 3px rgba(46,189,120,.12); }
.oga__avatar { flex: 0 0 auto; width: 38px; height: 38px; border-radius: 12px; object-fit: cover; }
.oga__avatar--mark { display: grid; place-items: center; color: #fff; background: var(--oga-accent); font-size: 20px; font-weight: 800; letter-spacing: -.11em; }
.oga__avatar--mark span { color: #d9d2ff; }
.oga__header-actions { display: flex; align-items: center; gap: 2px; }
.oga__icon-button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  color: #4d5668;
  background: transparent;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
}
.oga__icon-button:hover { color: var(--oga-ink); background: #f2f3f6; }
.oga__icon-button:disabled { opacity: .35; cursor: default; }
.oga__icon-button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.oga__privacy-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 16px;
  color: #596274;
  background: #fafafe;
  border-bottom: 1px solid var(--oga-line);
  font-size: 10.5px;
  line-height: 1.35;
}
.oga__privacy-note span { color: var(--oga-accent); font-size: 14px; line-height: 1; }
.oga__messages { overflow-y: auto; overscroll-behavior: contain; padding: 18px 16px 12px; scroll-behavior: smooth; }
.oga__messages:focus-visible { outline-offset: -3px; }
.oga__message { display: flex; margin: 0 0 12px; }
.oga__message--user { justify-content: flex-end; }
.oga__bubble { max-width: 88%; padding: 11px 13px; border-radius: 14px; overflow-wrap: anywhere; }
.oga__message--assistant .oga__bubble { color: var(--oga-ink); background: #f2f3f7; border-bottom-left-radius: 4px; }
.oga__message--user .oga__bubble { color: #fff; background: var(--oga-accent); border-bottom-right-radius: 4px; }
.oga__bubble p { margin: 0 0 8px; }
.oga__bubble p:last-child, .oga__bubble ul:last-child, .oga__bubble ol:last-child { margin-bottom: 0; }
.oga__bubble ul, .oga__bubble ol { margin: 7px 0; padding-left: 20px; }
.oga__bubble a { color: #4a35d1; text-decoration: underline; text-underline-offset: 2px; }
.oga__message--user .oga__bubble a { color: inherit; }

.oga__typing { display: inline-flex; align-items: center; gap: 4px; min-height: 18px; }
.oga__typing i { width: 5px; height: 5px; background: #747d8e; border-radius: 50%; animation: oga-dot 1s infinite ease-in-out; }
.oga__typing i:nth-child(2) { animation-delay: .14s; }
.oga__typing i:nth-child(3) { animation-delay: .28s; }
@keyframes oga-dot { 0%, 55%, 100% { transform: translateY(0); opacity: .45; } 25% { transform: translateY(-3px); opacity: 1; } }

.oga__route {
  max-width: 96%;
  margin: 4px 0 16px;
  padding: 5px;
  border: 1px solid #dddff0;
  border-radius: 17px;
  background: linear-gradient(145deg, #fff 0 68%, var(--oga-soft) 100%);
  box-shadow: 0 8px 24px rgba(34,46,72,.06);
}
.oga__route-head { padding: 11px 11px 8px; }
.oga__route-kicker { display: flex; align-items: center; gap: 7px; margin: 0 0 3px; color: var(--oga-accent); font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.oga__route-kicker::before { content: ""; width: 18px; height: 1px; background: currentColor; }
.oga__route-title { margin: 0; color: var(--oga-ink); font: 750 14px/1.35 "Plus Jakarta Sans", "DM Sans", system-ui, sans-serif; }
.oga__options { display: grid; gap: 6px; padding: 4px; }
.oga__option {
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 11px;
  color: #263147;
  text-align: left;
  background: #fff;
  border: 1px solid var(--oga-line);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color .16s ease, transform .16s ease, background .16s ease;
}
.oga__option::after { content: "→"; flex: 0 0 auto; color: var(--oga-accent); font-weight: 800; }
.oga__option:hover { transform: translateX(2px); border-color: color-mix(in srgb, var(--oga-accent) 45%, #d8dbe5); background: #fbfaff; }
.oga__option--quiet { color: var(--oga-muted); background: transparent; border-color: transparent; }
.oga__option--quiet::after { content: "↩"; }

.oga__lead { margin: 2px 0 16px; padding: 14px; border: 1px solid var(--oga-line); border-radius: 16px; background: #fff; }
.oga__lead h3 { margin: 0 0 4px; color: var(--oga-ink); font: 750 15px/1.3 "Plus Jakarta Sans", "DM Sans", system-ui, sans-serif; }
.oga__lead > p { margin: 0 0 13px; color: var(--oga-muted); font-size: 12px; }
.oga__field { margin-bottom: 10px; }
.oga__field label { display: block; margin-bottom: 4px; color: #374155; font-size: 11px; font-weight: 700; }
.oga__field input, .oga__field textarea, .oga__field select {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  color: var(--oga-ink);
  background: #fff;
  border: 1px solid #ccd0dc;
  border-radius: 9px;
  box-shadow: none;
}
.oga__field textarea { min-height: 78px; resize: vertical; }
.oga__field [aria-invalid="true"] { border-color: var(--oga-danger); }
.oga__field-error { display: block; margin-top: 3px; color: var(--oga-danger); font-size: 11px; }
.oga__consent { display: flex !important; align-items: flex-start; gap: 8px; font-weight: 500 !important; line-height: 1.35; }
.oga__consent input { width: 17px; min-height: 17px; margin: 1px 0 0; }
.oga__primary { width: 100%; min-height: 43px; padding: 9px 14px; color: #fff; background: var(--oga-accent); border: 0; border-radius: 10px; font-weight: 750; cursor: pointer; }
.oga__primary:disabled { opacity: .6; cursor: wait; }

.oga__composer-wrap { padding: 9px 12px 10px; background: #fff; border-top: 1px solid var(--oga-line); }
.oga__handoff { display: flex; gap: 6px; overflow-x: auto; padding: 0 1px 8px; scrollbar-width: none; }
.oga__handoff:empty { display: none; }
.oga__handoff a, .oga__handoff button { flex: 0 0 auto; min-height: 31px; padding: 6px 9px; color: #465066; background: #f5f6f8; border: 1px solid #e4e6ec; border-radius: 999px; font-size: 11px; font-weight: 700; text-decoration: none; cursor: pointer; }
.oga__handoff a:hover, .oga__handoff button:hover { color: var(--oga-accent); border-color: #cbc4ff; }
.oga__composer { display: grid; grid-template-columns: minmax(0, 1fr) 40px; gap: 7px; padding: 5px; background: #f5f6f8; border: 1px solid #e3e5eb; border-radius: 13px; }
.oga__composer:focus-within { border-color: var(--oga-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--oga-accent) 13%, transparent); }
.oga__composer input { min-width: 0; height: 40px; padding: 6px 8px; color: var(--oga-ink); background: transparent; border: 0; outline: 0; box-shadow: none; }
.oga__composer input::placeholder { color: #778091; opacity: 1; }
.oga__composer button { width: 40px; height: 40px; display: grid; place-items: center; padding: 0; color: #fff; background: var(--oga-accent); border: 0; border-radius: 9px; cursor: pointer; }
.oga__composer button:disabled { opacity: .55; cursor: wait; }
.oga__composer svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.oga__clear { display: block; margin: 6px auto -3px; padding: 2px 5px; color: #737b8a; background: transparent; border: 0; font-size: 10px; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }

html[dir="rtl"] .oga { text-align: right; }
html[dir="rtl"] .oga__option { text-align: right; }
html[dir="rtl"] .oga__option::after { content: "←"; }
html[dir="rtl"] .oga__option:hover { transform: translateX(-2px); }
html[dir="rtl"] .oga__message--user { justify-content: flex-start; }
html[dir="rtl"] .oga__bubble ul, html[dir="rtl"] .oga__bubble ol { padding-left: 0; padding-right: 20px; }

@media (max-width: 520px) {
  .oga, .oga--right, .oga--left { right: 12px; left: auto; bottom: max(12px, env(safe-area-inset-bottom)); }
  .oga__launcher { min-height: 50px; padding-right: 14px; }
  .oga__launcher-mark { width: 36px; height: 36px; }
  .oga__panel {
    position: fixed;
    inset: max(8px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom));
    width: auto;
    height: auto;
    min-height: 0;
    border-radius: 18px;
    transform-origin: bottom center;
  }
  .oga__launcher[aria-expanded="true"] { visibility: hidden; }
  body.oga-is-open { overflow: hidden; }
}

@media (prefers-reduced-motion: reduce) {
  .oga *, .oga *::before, .oga *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

@media (forced-colors: active) {
  .oga__launcher, .oga__composer button, .oga__primary { border: 1px solid ButtonText; }
  .oga__panel, .oga__route, .oga__bubble, .oga__option { border: 1px solid CanvasText; }
}
