/* Scoped public assistant, independent of page and CRM form styles. */
.ywa-widget {
  --ywa-paper: #fffdf8;
  --ywa-bg: #fbf7ef;
  --ywa-ink: #20232a;
  --ywa-muted: #686158;
  --ywa-gold: #9b7539;
  --ywa-line: #ded0b7;
  position: fixed;
  z-index: 1000;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  width: min(390px, calc(100vw - 32px));
  color: var(--ywa-ink);
  font: 14px/1.5 Arial, Helvetica, sans-serif;
  color-scheme: light;
  text-align: left;
  letter-spacing: normal;
  -webkit-text-size-adjust: 100%;
}
.ywa-widget *, .ywa-widget *::before, .ywa-widget *::after { box-sizing: border-box; }
.ywa-widget [hidden], .ywa-widget[hidden] { display: none !important; }
.ywa-widget p, .ywa-widget h2, .ywa-widget h3 { margin: 0; }
.ywa-widget button, .ywa-widget input, .ywa-widget textarea, .ywa-widget select { font: inherit; letter-spacing: normal; }
.ywa-widget button { cursor: pointer; text-transform: none; }
.ywa-widget button:disabled { cursor: default; opacity: .58; }
.ywa-widget a { color: #785722; text-underline-offset: 3px; }
.ywa-widget :is(button, a, input, textarea, select):focus-visible { outline: 3px solid #9b7539; outline-offset: 3px; }
.ywa-launcher {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: auto;
  min-height: 58px;
  margin: 0 0 0 auto;
  padding: 10px 20px 10px 15px;
  border: 1px solid #ddc49d;
  border-radius: 32px;
  background: #20232a;
  color: #fffaf0;
  box-shadow: 0 7px 28px rgba(32, 35, 42, .2);
  font-weight: 600 !important;
  transition: background .18s, transform .18s;
}
.ywa-launcher:hover { background: #39352e; transform: translateY(-1px); }
.ywa-launcher-label { white-space: nowrap; }
.ywa-avatar { display: grid; place-items: center; width: 38px; height: 38px; flex: 0 0 38px; }
.ywa-widget .ywa-avatar-image { display: block; width: 100%; height: 100%; max-width: none; margin: 0; border: 1px solid #d9bb85; border-radius: 50%; object-fit: cover; }
.ywa-avatar-ready > .ywa-egg { display: none; }
.ywa-header > .ywa-avatar { width: 48px; height: 48px; flex-basis: 48px; }
.ywa-egg {
  position: relative;
  display: inline-block;
  width: 29px;
  height: 36px;
  flex: 0 0 29px;
  border: 1px solid #d9bb85;
  border-radius: 49% 49% 44% 44% / 62% 62% 38% 38%;
  background: radial-gradient(ellipse at 33% 24%, #fffefa 8%, #f5e6c8 60%, #cfaa6e 100%);
  box-shadow: inset -3px -3px 7px rgba(130, 88, 25, .1);
}
.ywa-egg-eyes { position: absolute; top: 15px; left: 8px; width: 3px; height: 3px; border-radius: 50%; background: #594528; box-shadow: 8px 0 #594528; }
.ywa-egg-mouth { position: absolute; top: 21px; left: 11px; width: 6px; height: 3px; border-bottom: 1px solid #594528; border-radius: 50%; }
.ywa-panel {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: min(720px, calc(100vh - 110px));
  max-height: min(720px, calc(100dvh - 110px));
  margin-bottom: 12px;
  overflow: hidden;
  border: 1px solid var(--ywa-line);
  border-radius: 18px;
  background: var(--ywa-paper);
  box-shadow: 0 16px 60px rgba(44, 35, 23, .2), 0 2px 10px rgba(44, 35, 23, .05);
  animation: ywa-enter .22s ease-out;
}
.ywa-header {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 12px;
  padding: 17px 12px 17px 20px;
  border-bottom: 1px solid var(--ywa-line);
  background: #f6efdf;
}
.ywa-heading { min-width: 0; flex: 1; }
.ywa-widget .ywa-title { font: 19px/1.2 Georgia, 'Times New Roman', serif; color: var(--ywa-ink); letter-spacing: -.02em; }
.ywa-widget .ywa-subtitle { margin-top: 5px; font-size: 11px; line-height: 1.4; color: #655c4e; }
.ywa-close { display: grid; place-items: center; width: 38px; height: 38px; flex: 0 0 38px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #655c4e; font-size: 28px !important; line-height: 1 !important; }
.ywa-close:hover { background: #e9deca; color: #20232a; }
.ywa-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 20px; scrollbar-width: thin; }
.ywa-widget .ywa-intro { padding-bottom: 14px; }
.ywa-widget .ywa-greeting { font-size: 15px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.ywa-widget .ywa-hint { color: var(--ywa-muted); font-size: 13px; line-height: 1.5; margin-bottom: 17px; overflow-wrap: anywhere; }
.ywa-widget .ywa-step-title { margin: 0 0 12px; font: 23px/1.25 Georgia, 'Times New Roman', serif; color: var(--ywa-ink); letter-spacing: -.02em; }
.ywa-form { display: flex; flex-direction: column; gap: 15px; margin: 0; width: 100%; }
.ywa-field { display: flex; flex-direction: column; gap: 6px; color: #4e483f; font-size: 12px; font-weight: 600; }
.ywa-widget input:not([type="checkbox"]), .ywa-widget textarea, .ywa-widget select {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #cfc1a8;
  border-radius: 7px;
  background: #fffefa;
  box-shadow: none;
  color: var(--ywa-ink);
  font-size: 16px;
  line-height: 1.4;
  font-weight: 400;
}
.ywa-widget input::placeholder, .ywa-widget textarea::placeholder { color: #8a8173; opacity: 1; }
.ywa-widget .ywa-code { font-size: 26px !important; text-align: center; letter-spacing: .35em; padding-left: 20px; }
.ywa-consent { display: flex; gap: 10px; align-items: flex-start; font-size: 11px; line-height: 1.55; color: #625a4e; cursor: pointer; }
.ywa-widget .ywa-consent input { appearance: auto; width: 18px; height: 18px; min-width: 18px; margin: 2px 0 0; padding: 0; border: 1px solid var(--ywa-line); accent-color: #785722; }
.ywa-primary { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 46px; padding: 12px 16px; border: 1px solid #20232a; border-radius: 7px; background: #20232a; color: #fffdf8; font-size: 14px; font-weight: 600; line-height: 1.4; }
.ywa-primary:hover:not(:disabled) { background: #39352e; }
.ywa-text-button { display: block; width: fit-content; max-width: 100%; min-height: 38px; margin: 4px 0 0; padding: 8px 0; border: 0; border-radius: 3px; background: transparent; color: #785722; text-align: left; font-size: 12px !important; text-decoration: underline; text-underline-offset: 3px; }
.ywa-widget .ywa-fineprint { color: var(--ywa-muted); font-size: 11px; line-height: 1.5; }
.ywa-captcha { min-height: 0; max-width: 100%; }
.ywa-captcha iframe { max-width: 100%; }
.ywa-widget .ywa-captcha-status { color: var(--ywa-muted); font-size: 12px; line-height: 1.4; }
.ywa-cases { display: flex; flex-direction: column; gap: 10px; }
.ywa-case { display: block; width: 100%; min-height: 46px; padding: 12px 14px; text-align: left; border: 1px solid var(--ywa-line); border-radius: 7px; color: var(--ywa-ink); background: var(--ywa-bg); overflow-wrap: anywhere; }
.ywa-case:hover { background: #f1e7d6; }
.ywa-body-chat { display: flex; flex-direction: column; gap: 14px; min-height: 280px; height: 490px; padding: 14px 16px 16px; overflow: hidden; }
.ywa-toolbar { display: flex; gap: 12px; align-items: end; flex: 0 0 auto; }
.ywa-case-label { flex: 1; min-width: 0; font-size: 10px; color: var(--ywa-muted); }
.ywa-widget .ywa-case-select { min-height: 36px; padding: 6px 24px 6px 8px; font-size: 12px; margin-top: 3px; }
.ywa-toolbar .ywa-account { flex: 0 0 auto; font-size: 10px !important; margin: 0; min-height: 36px; text-align: right; }
.ywa-messages { min-height: 70px; flex: 1 1 auto; overflow: auto; overscroll-behavior: contain; padding: 2px 3px 5px; scrollbar-width: thin; }
.ywa-message { width: fit-content; max-width: 94%; padding: 12px 13px; border: 1px solid #e9dfcf; border-radius: 11px 11px 11px 3px; background: #f6f0e5; overflow-wrap: anywhere; }
.ywa-message + .ywa-message { margin-top: 12px; }
.ywa-message-user { margin-left: auto; border-color: #dadde0; border-radius: 11px 11px 3px 11px; background: #eef0f1; }
.ywa-message-author { display: block; margin-bottom: 4px; color: #72634f; font-size: 10px; font-weight: 600; }
.ywa-widget .ywa-message p { white-space: pre-wrap; font-size: 13px; line-height: 1.6; color: var(--ywa-ink); }
.ywa-compose { display: flex; flex-direction: column; flex: 0 0 auto; gap: 8px; margin: 0; }
.ywa-attach { align-self: flex-start; min-height: 36px; padding: 7px 12px; border: 1px solid var(--ywa-line); border-radius: 7px; background: var(--ywa-paper); color: #785722; font-size: 12px !important; }
.ywa-attach:hover:not(:disabled) { background: #f6efdf; }
.ywa-widget .ywa-file-help { color: var(--ywa-muted); font-size: 10px; line-height: 1.4; }
.ywa-file-list { max-height: 100px; overflow: auto; border: 1px solid var(--ywa-line); border-radius: 7px; padding: 4px 8px; }
.ywa-file-row { display: flex; align-items: center; gap: 8px; }
.ywa-file-name { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 11px; }
.ywa-file-remove { width: 32px; height: 32px; flex: 0 0 32px; border: 0; border-radius: 50%; background: transparent; color: #655c4e; font-size: 20px !important; }
.ywa-saved-file { display: block; margin-top: 8px; padding-top: 7px; border-top: 1px solid #dadde0; font-size: 11px; overflow-wrap: anywhere; }
.ywa-widget .ywa-compose textarea { min-height: 65px; max-height: 145px; resize: vertical; font-size: 16px; }
.ywa-compose .ywa-primary { min-height: 42px; padding: 10px 12px; }
.ywa-widget .ywa-status { flex: 0 0 auto; padding: 10px 20px; border-top: 1px solid #e9dfcf; color: #655c4e; background: #f9f4e9; font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; }
.ywa-widget .ywa-status.ywa-error { color: #8b352a; background: #fff2ed; }
.ywa-recovery { margin: 8px 20px; min-height: 38px; padding: 8px 12px; border: 1px solid #b59765; border-radius: 6px; color: #785722; background: #fffdf8; font-size: 12px !important; }
.ywa-widget .ywa-footer { flex: 0 0 auto; padding: 10px 15px; border-top: 1px solid #e9dfcf; color: #796f60; background: #fcf8f0; text-align: center; font-size: 9px; line-height: 1.4; }
.ywa-sr-only { position: absolute !important; width: 1px !important; height: 1px !important; margin: -1px !important; padding: 0 !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
.ywa-thinking .ywa-header .ywa-egg { animation: ywa-think 1.4s ease-in-out infinite; }
.ywa-thinking .ywa-header .ywa-avatar-image { animation: ywa-portrait-think 1.4s ease-in-out infinite; }
.ywa-thinking .ywa-header .ywa-egg-mouth { animation: ywa-speak .7s ease-in-out infinite; }
@keyframes ywa-enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes ywa-think { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg) translateY(-2px); } }
@keyframes ywa-speak { 0%, 100% { height: 3px; } 50% { height: 5px; } }
@keyframes ywa-portrait-think { 0%, 100% { box-shadow: 0 0 0 0 rgba(155, 117, 57, .1); } 50% { box-shadow: 0 0 0 4px rgba(155, 117, 57, .2); } }
@media (max-width: 480px) {
  .ywa-widget { right: max(12px, env(safe-area-inset-right)); bottom: max(12px, env(safe-area-inset-bottom)); width: calc(100vw - 24px); }
  .ywa-panel { max-height: calc(100vh - 100px - env(safe-area-inset-bottom)); max-height: calc(100dvh - 100px - env(safe-area-inset-bottom)); border-radius: 14px; margin-bottom: 10px; }
  .ywa-header { padding: 13px 9px 13px 16px; gap: 10px; }
  .ywa-widget .ywa-title { font-size: 18px; }
  .ywa-body { padding: 17px 16px; }
  .ywa-body-chat { padding: 12px; gap: 10px; height: 480px; min-height: 210px; }
  .ywa-open .ywa-launcher { min-height: 48px; height: 48px; padding: 7px 16px 7px 12px; }
  .ywa-open .ywa-launcher .ywa-avatar { width: 32px; height: 32px; flex-basis: 32px; }
  .ywa-open .ywa-launcher .ywa-egg { width: 24px; height: 30px; flex-basis: 24px; }
  .ywa-open .ywa-launcher .ywa-egg-eyes { left: 6px; top: 12px; }
  .ywa-open .ywa-launcher .ywa-egg-mouth { left: 9px; top: 19px; }
  .ywa-compose textarea { max-height: 100px !important; }
}
@media (max-width: 359px) {
  .ywa-widget { right: 8px; width: calc(100vw - 16px); }
  .ywa-body { padding: 15px 10px; overflow-x: hidden; }
  /* SmartCaptcha has a 300px minimum; keep its whole surface visible at 320px. */
  .ywa-captcha { width: 300px; min-width: 300px; max-width: none; transform: scale(.92); transform-origin: left top; margin-bottom: -6px; }
  .ywa-header { padding-left: 12px; }
  .ywa-header > .ywa-avatar { width: 38px; height: 38px; flex-basis: 38px; }
  .ywa-widget .ywa-title { font-size: 17px; }
}
@media (max-height: 600px) {
  .ywa-panel { max-height: calc(100vh - 80px); max-height: calc(100dvh - 80px); }
  .ywa-header { padding-top: 9px; padding-bottom: 9px; }
  .ywa-body-chat { min-height: 140px; gap: 8px; }
  .ywa-widget .ywa-footer { padding-top: 6px; padding-bottom: 6px; }
  .ywa-open .ywa-launcher { min-height: 44px; height: 44px; padding-top: 5px; padding-bottom: 5px; }
  .ywa-widget .ywa-compose textarea { min-height: 44px; height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .ywa-widget *, .ywa-widget *::before, .ywa-widget *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media print { .ywa-widget { display: none !important; } }
