.igraf-root {
  --igraf-ink: #0b0b0d;
  --igraf-paper: #f7f5f3;
  --igraf-line: #e7e1dd;
  --igraf-orange: #ff5a00;
  --igraf-action: #c4510d;
  --igraf-action-hover: #a33d08;
  --igraf-violet: #6f2cff;
  --igraf-dark: linear-gradient(115deg, #0b0b0d, #0b0713 58%, #251143);
  color: var(--igraf-ink);
  font: 400 14px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  text-align: left;
}

.igraf-root,
.igraf-root * {
  box-sizing: border-box;
}

.igraf-root [hidden] {
  display: none !important;
}

.igraf-root :is(button, input, textarea) {
  font: inherit;
  letter-spacing: normal;
  margin: 0;
  text-transform: none;
}

.igraf-root button {
  cursor: pointer;
}

.igraf-root button:disabled {
  opacity: 0.55;
  cursor: default;
}

.igraf-root :is(button, a, input, textarea, summary):focus-visible {
  outline: 2px solid #00799e;
  outline-offset: 2px;
}

.igraf-floating {
  --igraf-edge: 24px;
  --igraf-offset: 24px;
  --igraf-launcher-size: 66px;
  --igraf-gap: 12px;
  --igraf-safe-bottom: env(safe-area-inset-bottom, 0px);
  position: fixed;
  right: calc(var(--igraf-edge) + env(safe-area-inset-right, 0px));
  bottom: calc(var(--igraf-offset) + var(--igraf-safe-bottom));
  z-index: 99998;
}

/* Theme button rules often set radius and background on hover and focus. */
.igraf-root .igraf-launcher,
.igraf-root .igraf-launcher:is(:hover, :focus, :active) {
  display: grid;
  place-items: center;
  width: var(--igraf-launcher-size);
  height: var(--igraf-launcher-size);
  padding: 4px;
  border: 2px solid var(--igraf-orange);
  border-radius: 50%;
  background: radial-gradient(circle at 75% 20%, #342053, #151020 54%, #0b0b0d 75%);
  color: #fff;
  box-shadow: 0 8px 24px #0b0b0d42, inset 0 0 0 2px #ffffff16;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.igraf-root .igraf-launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 11px 28px #0b0b0d54, 0 0 0 4px #ff5a0026;
}

.igraf-avatar,
.igraf-bubble-close {
  grid-area: 1 / 1;
  transition: opacity 150ms ease, transform 150ms ease;
}

.igraf-root img.igraf-avatar {
  display: block;
  width: calc(var(--igraf-launcher-size) - 12px);
  height: calc(var(--igraf-launcher-size) - 12px);
  object-fit: contain;
}

.igraf-bubble-close {
  font-size: 32px;
  line-height: 1;
  opacity: 0;
  transform: scale(0.75);
}

.igraf-launcher[aria-expanded="true"] .igraf-avatar {
  opacity: 0;
  transform: scale(0.75);
}

.igraf-launcher[aria-expanded="true"] .igraf-bubble-close {
  opacity: 1;
  transform: scale(1);
}

.igraf-panel {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 614px;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  border: 1px solid #dad2e0;
  border-radius: 24px;
  background: var(--igraf-paper);
  overflow: hidden;
  box-shadow: 0 22px 70px #1b102d33, 0 4px 14px #1b102d18;
}

.igraf-floating .igraf-panel {
  --igraf-clearance: calc(var(--igraf-offset) + var(--igraf-safe-bottom) + var(--igraf-launcher-size) + var(--igraf-gap) + 14px);
  position: absolute;
  right: 0;
  bottom: calc(var(--igraf-launcher-size) + var(--igraf-gap));
  width: min(416px, calc(100vw - var(--igraf-edge) - var(--igraf-edge) - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
  max-height: calc(100vh - var(--igraf-clearance));
  max-height: calc(100dvh - var(--igraf-clearance));
}

.igraf-floating .igraf-panel[data-empty] {
  height: auto;
}

.igraf-panel:not([hidden]) {
  animation: igraf-appear 180ms ease-out;
}

@keyframes igraf-appear {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.igraf-header {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 12px;
  padding: 15px 16px;
  border-bottom: 2px solid transparent;
  background: var(--igraf-dark) padding-box, linear-gradient(90deg, var(--igraf-orange), var(--igraf-violet)) border-box;
  color: #fff;
}

.igraf-root img.igraf-face {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  padding: 3px;
  border: 1px solid #ffffff38;
  border-radius: 50%;
  background: #ffffff14;
  object-fit: contain;
}

.igraf-title {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.igraf-title strong {
  font-size: 21px;
  font-weight: 800;
  line-height: 1.14;
}

.igraf-title span {
  color: #e4dfe9;
  font-size: 12px;
}

.igraf-header-actions {
  display: flex;
  gap: 6px;
}

.igraf-root .igraf-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid #ffffff32;
  border-radius: 12px;
  background: #ffffff0d;
  color: #fff;
  font-size: 23px;
  line-height: 1;
}

.igraf-root .igraf-icon:hover {
  background: #ffffff24;
}

.igraf-root .igraf-header button:focus-visible,
.igraf-root .igraf-launcher:focus-visible {
  outline-color: #00aeef;
}

.igraf-stream {
  flex: 1 1 auto;
  min-height: 0;
  padding: 19px 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: radial-gradient(ellipse at 100% 0%, #eee6f8 0, transparent 190px), var(--igraf-paper);
}

.igraf-welcome {
  padding: 17px 18px 19px;
  border: 1px solid var(--igraf-line);
  border-radius: 17px;
  background: #fff;
  box-shadow: 0 3px 12px #2616250a;
}

.igraf-welcome::before {
  display: block;
  width: 23px;
  height: 3px;
  margin-bottom: 10px;
  border-radius: 4px;
  background: var(--igraf-orange);
  content: '';
}

.igraf-root .igraf-welcome h2 {
  margin: 0 0 6px;
  color: var(--igraf-ink);
  font-family: inherit;
  font-size: 21px;
  font-weight: 800;
  line-height: 1.22;
  letter-spacing: normal;
}

.igraf-root .igraf-welcome p {
  margin: 0;
  color: #4b424b;
  font-size: 14px;
}

.igraf-message {
  max-width: 95%;
  margin: 0 0 13px;
  font-size: 14px;
}

.igraf-rating {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 8px;
  margin: 7px 0 0;
  color: #5c5263;
  font-size: 12px;
}

.igraf-root .igraf-rating button {
  min-width: 44px;
  min-height: 34px;
  padding: 3px 8px;
  border: 1px solid #e2d6ed;
  border-radius: 9px;
  background: #faf7fd;
  color: #422959;
  font-size: 12px;
  font-weight: 700;
}

.igraf-root .igraf-rating button:hover:not(:disabled),
.igraf-root .igraf-rating button[aria-pressed="true"] {
  border-color: #baaad1;
  background: #f0e7f9;
  opacity: 1;
}

.igraf-rating-status:not(:empty) { flex-basis: 100%; }

@media (pointer: coarse) {
  .igraf-root .igraf-rating button { min-height: 44px; }
}

.igraf-copy {
  padding: 12px 14px;
  border: 1px solid var(--igraf-line);
  border-radius: 16px 16px 16px 5px;
  background: #fff;
  color: #312933;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.55;
}

.igraf-user {
  width: fit-content;
  max-width: 87%;
  margin-left: auto;
}

.igraf-user .igraf-copy {
  border-color: transparent;
  border-radius: 16px 16px 5px 16px;
  background: var(--igraf-dark);
  color: #fff;
}

.igraf-thinking {
  padding: 5px 2px;
  color: #5c5263;
  font-size: 12px;
}

.igraf-thinking::before {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin: 0 7px 2px 0;
  border-radius: 50%;
  background: var(--igraf-violet);
  content: '';
}

.igraf-links {
  display: grid;
  gap: 6px;
  margin-top: 7px;
}

.igraf-root a.igraf-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 38px;
  padding: 8px 11px;
  border: 1px solid #e2d6ed;
  border-radius: 10px;
  background: #faf7fd;
  color: #422959;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  overflow-wrap: anywhere;
  text-decoration: none;
}

.igraf-root a.igraf-link:hover {
  border-color: #baaad1;
  background: #f0e7f9;
  color: #321745;
}

.igraf-root a.igraf-link-contact {
  border-color: #f1cdb7;
  background: #fff6ef;
  color: #873308;
}

.igraf-root a.igraf-link-contact:hover {
  border-color: #d49168;
  background: #ffecdc;
  color: #712808;
}

.igraf-links .igraf-link::after {
  flex-shrink: 0;
  width: 7px;
  height: 7px;
  border-top: 1.5px solid currentColor;
  border-right: 1.5px solid currentColor;
  transform: rotate(45deg);
  content: '';
}

.igraf-sources {
  margin-top: 8px;
  color: #5e5065;
  font-size: 12px;
}

.igraf-sources summary {
  cursor: pointer;
  padding: 4px 0;
}

.igraf-root .igraf-sources a.igraf-link,
.igraf-root .igraf-footer a.igraf-link {
  min-height: 0;
  padding: 4px 0;
  border: 0;
  background: transparent;
  font-weight: 500;
  text-decoration: underline;
}

.igraf-dock {
  display: grid;
  flex-shrink: 0;
  gap: 8px;
  padding: 11px 15px 9px;
  border-top: 1px solid var(--igraf-line);
  background: #fff;
}

.igraf-quick {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
}

.igraf-root .igraf-quick :is(button, a.igraf-link) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 36px;
  padding: 5px 7px;
  border: 1px solid #ddd5e4;
  border-radius: 999px;
  background: #fff;
  color: #3f3049;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.2;
  text-align: center;
}

.igraf-root .igraf-quick :is(button, a.igraf-link):hover {
  border-color: #bfa9db;
  background: #faf6fe;
}

.igraf-root .igraf-quick button.igraf-quick-contact {
  border-color: #efc9b3;
  background: #fff4eb;
  color: #873308;
}

.igraf-root .igraf-quick button.igraf-quick-contact:hover {
  border-color: #d49168;
  background: #ffecdc;
}

.igraf-composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 4px;
  border: 1px solid #d7d0db;
  border-radius: 15px;
  background: #faf8fb;
}

.igraf-composer:focus-within {
  border-color: #8f68c3;
  box-shadow: 0 0 0 2px #6f2cff19;
}

.igraf-root .igraf-input {
  flex: 1;
  width: 100%;
  min-width: 0;
  min-height: 42px;
  max-height: 100px;
  padding: 10px 8px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--igraf-ink);
  font-size: 14px;
  line-height: 1.5;
  box-shadow: none;
  resize: none;
  field-sizing: content;
}

.igraf-root .igraf-input:focus-visible {
  outline: none;
}

.igraf-root .igraf-input::placeholder {
  color: #6c626d;
}

.igraf-root .igraf-send,
.igraf-root .igraf-lead-button {
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--igraf-action);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.3;
}

.igraf-root .igraf-send {
  display: grid;
  flex-shrink: 0;
  place-items: center;
  width: 44px;
  padding: 0;
  font-size: 23px;
}

.igraf-root :is(.igraf-send, .igraf-lead-button):hover:not(:disabled) {
  background: var(--igraf-action-hover);
}

.igraf-root .igraf-lead-button {
  margin-top: 8px;
}

.igraf-root label.igraf-archive {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 26px;
  color: #49404c;
  font-size: 12px;
  cursor: pointer;
}

.igraf-root :is(.igraf-archive, .igraf-consent) input {
  flex-shrink: 0;
  width: 15px;
  height: 15px;
  accent-color: var(--igraf-action-hover);
}

.igraf-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 9px;
  color: #655b68;
  font-size: 11px;
  line-height: 1.35;
}

.igraf-root .igraf-footer a.igraf-link {
  color: #422959;
  font-size: inherit;
}

.igraf-lead {
  margin-bottom: 13px;
  padding: 15px;
  border: 1px solid #e8d6e1;
  border-radius: 16px;
  background: #fff;
  color: #3b303e;
  font-size: 13px;
}

.igraf-root .igraf-lead h3 {
  margin: 0 0 6px;
  color: var(--igraf-ink);
  font-size: 17px;
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: normal;
}

.igraf-root .igraf-lead p {
  margin: 0 0 9px;
}

.igraf-root .igraf-lead > label {
  display: block;
  margin: 10px 0;
  font-weight: 700;
}

.igraf-root .igraf-lead :is(input:not([type="checkbox"]), textarea) {
  display: block;
  width: 100%;
  min-height: 42px;
  margin-top: 4px;
  padding: 8px 10px;
  border: 1px solid #d7cddc;
  border-radius: 10px;
  background: #fff;
  color: var(--igraf-ink);
}

.igraf-root .igraf-lead label.igraf-consent {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  font-size: 12px;
  font-weight: 400;
}

.igraf-consent input {
  margin-top: 2px;
}

.igraf-root .igraf-cancel {
  min-height: 42px;
  padding: 6px 10px;
  border: 0;
  background: transparent;
  color: #4a3a56;
  font-size: 12px;
  font-weight: 650;
}

.igraf-honeypot {
  position: absolute !important;
  left: -10000px !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.igraf-root .igraf-lead .igraf-form-status {
  margin: 8px 0 0;
  color: #873308;
}

.igraf-form-status:empty {
  display: none;
}

@media (max-width: 560px) {
  .igraf-floating {
    --igraf-edge: 12px;
    --igraf-offset: 86px;
    --igraf-launcher-size: 60px;
    --igraf-gap: 9px;
  }

  .igraf-panel { border-radius: 21px; }
  .igraf-header { padding: 12px; }
  .igraf-root .igraf-icon { width: 44px; height: 44px; }
  .igraf-stream { padding: 14px 12px; }
  .igraf-dock { padding-inline: 11px; }
  .igraf-quick { gap: 4px; }
  .igraf-root .igraf-quick :is(button, a.igraf-link) { min-height: 42px; padding-inline: 6px; }
  .igraf-root .igraf-links a.igraf-link { min-height: 42px; }
  .igraf-root .igraf-send { min-height: 44px; }
  .igraf-root :is(.igraf-input, .igraf-lead input:not([type="checkbox"]), .igraf-lead textarea) { font-size: 16px; }
}

@media (max-width: 360px) {
  .igraf-quick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-height: 500px) and (max-width: 940px) {
  .igraf-floating { --igraf-offset: 10px; }
  .igraf-floating .igraf-panel { bottom: 0; --igraf-clearance: calc(var(--igraf-offset) + var(--igraf-safe-bottom) + 10px); }
  .igraf-floating .igraf-launcher[aria-expanded="true"] { visibility: hidden; }
}

.igraf-floating.igraf-keyboard {
  bottom: calc(var(--igraf-keyboard) + 8px);
}

.igraf-floating.igraf-keyboard .igraf-panel {
  bottom: 0;
  max-height: calc(var(--igraf-visual-height) - 16px);
}

.igraf-floating.igraf-keyboard .igraf-launcher {
  visibility: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .igraf-launcher,
  .igraf-avatar,
  .igraf-bubble-close { transition: none; }
  .igraf-panel:not([hidden]) { animation: none; }
}
