.jtal-launcher {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 950;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 98px;
  min-height: 50px;
  padding: 0 20px;
  border: none;
  border-radius: 25px;
  background: linear-gradient(135deg, #7b1fa2, #4a0072);
  box-shadow: 0 8px 24px rgba(74, 0, 114, 0.32);
  color: #fff;
  font: 600 0.92rem/1.1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.jtal-launcher:hover,
.jtal-launcher:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(74, 0, 114, 0.38);
}
.jtal-launcher.jtal-active {
  background: #fff;
  box-shadow: 0 0 0 2px #7b1fa2, 0 10px 28px rgba(74, 0, 114, 0.32);
  color: #4a0072;
}
.jtal-launcher.jtal-active::before {
  background: #7b1fa2;
  box-shadow: 0 0 0 4px rgba(123, 31, 162, 0.12);
}
.jtal-panel {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: calc(max(18px, env(safe-area-inset-bottom)) + 58px);
  z-index: 1200;
  display: none;
  grid-template-rows: auto auto minmax(100px, 1fr) auto auto;
  width: min(430px, calc(100vw - 32px));
  max-height: min(700px, calc(100dvh - 92px));
  overflow: hidden;
  border: 1px solid var(--border, #f3e5f5);
  border-radius: 10px;
  background: var(--bg, #f5f9ff);
  box-shadow: 0 22px 58px rgba(74, 0, 114, 0.24);
  color: var(--text, #1a237e);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
  text-align: left;
}
.jtal-panel.jtal-open { display: grid; }
.jtal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
  background: linear-gradient(135deg, #7b1fa2, #4a0072);
}
.jtal-topics {
  border-bottom: 1px solid var(--border, #f3e5f5);
  background: #fff;
}
.jtal-topics summary {
  display: none;
  color: #4a0072;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 700;
  list-style: none;
}
.jtal-topics summary::-webkit-details-marker { display: none; }
.jtal-topics summary::after {
  content: "+";
  margin-left: auto;
  color: #7e57c2;
  font-size: 1rem;
}
.jtal-topics[open] summary::after { content: "−"; }
.jtal-title {
  margin: 0;
  color: #fff;
  font-size: 1.05rem;
  font-weight: 500;
  line-height: 1.3;
}
.jtal-description {
  margin: 4px 0 0;
  color: #f3e5f5;
  font-size: 0.76rem;
  line-height: 1.4;
}
.jtal-icon-button {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
}
.jtal-icon-button:hover,
.jtal-icon-button:focus-visible { border-color: #ffeb3b; }
.jtal-quick {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 10px;
  background: #fff;
}
.jtal-quick-button,
.jtal-action,
.jtal-special-action,
.jtal-submit,
.jtal-clear {
  min-height: 38px;
  border: 1px solid rgba(123, 31, 162, 0.18);
  border-radius: 8px;
  font: 600 0.78rem/1.2 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
  cursor: pointer;
}
.jtal-quick-button {
  min-width: 0;
  min-height: 42px;
  padding: 7px;
  background: #f3e5f5;
  color: #4a0072;
  font-size: 0.72rem;
  text-align: left;
}
.jtal-quick-button:nth-child(1),
.jtal-quick-button:nth-child(2) {
  border-color: rgba(255, 179, 0, 0.28);
  background: #fff8e1;
  color: #6d4700;
}
.jtal-quick-button:hover,
.jtal-quick-button:focus-visible { border-color: rgba(123, 31, 162, 0.42); }
.jtal-messages {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--bg, #f5f9ff);
}
.jtal-message {
  max-width: 92%;
  padding: 11px 12px;
  border: 1px solid var(--border, #f3e5f5);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.04);
  color: #37474f;
  font-size: 0.86rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
  white-space: pre-line;
}
.jtal-message-user {
  justify-self: end;
  border-color: rgba(123, 31, 162, 0.16);
  background: #f3e5f5;
  color: #4a0072;
}
.jtal-message-title {
  display: block;
  margin-bottom: 4px;
  color: #4a0072;
  font-weight: 700;
}
.jtal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}
.jtal-action,
.jtal-special-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 10px;
  background: #f3e5f5;
  color: #4a0072;
  text-decoration: none;
}
.jtal-special-action {
  border: none;
  background: linear-gradient(135deg, #ffb300, #ff9800);
  color: #1a237e;
}
.jtal-note {
  margin: 0;
  padding: 9px 14px;
  border-top: 1px solid var(--border, #f3e5f5);
  background: #fff;
  color: #7e57c2;
  font-size: 0.69rem;
  line-height: 1.4;
}
.jtal-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
  padding: 10px 12px max(10px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--border, #f3e5f5);
  background: #fff;
}
.jtal-form-label {
  grid-column: 1 / -1;
  color: #4a0072;
  font-size: 0.76rem;
  font-weight: 700;
}
.jtal-input {
  min-width: 0;
  min-height: 42px;
  padding: 0 11px;
  border: 1px solid rgba(123, 31, 162, 0.18);
  border-radius: 8px;
  outline: none;
  background: #fff;
  color: #263238;
  font: inherit;
  pointer-events: auto;
  touch-action: auto;
}
.jtal-input:focus {
  border-color: rgba(123, 31, 162, 0.5);
  box-shadow: 0 0 0 3px rgba(123, 31, 162, 0.12);
}
.jtal-submit {
  padding: 0 14px;
  border: none;
  background: linear-gradient(135deg, #7b1fa2, #4a0072);
  color: #fff;
}
.jtal-submit:disabled,
.jtal-input:disabled { cursor: wait; opacity: 0.65; }
.jtal-clear {
  grid-column: 1 / -1;
  min-height: 30px;
  border-color: transparent;
  background: transparent;
  color: #7e57c2;
}
body.jtal-modal-open { overflow: visible; }
@media (max-width: 560px) {
  .jtal-launcher {
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    min-width: 82px;
    min-height: 44px;
    padding: 0 14px;
    border-radius: 22px;
    font-size: 0.78rem;
  }
  .jtal-launcher.jtal-active { display: none; }
  .jtal-panel {
    top: calc(var(--jtal-viewport-top, 0px) + max(6px, env(safe-area-inset-top)));
    right: 6px;
    bottom: auto;
    left: 6px;
    width: auto;
    height: calc(min(var(--jtal-viewport-height, 100dvh), 100dvh) - 12px);
    max-height: calc(min(var(--jtal-viewport-height, 100dvh), 100dvh) - 12px);
    transform: translateZ(0);
    contain: layout paint;
    grid-template-rows: auto auto minmax(100px, 1fr) auto auto;
    border-radius: 10px;
    animation: jtal-mobile-open 0.2s ease-out;
  }
  .jtal-header { align-items: center; padding: 13px 14px; }
  .jtal-description { margin-top: 2px; }
  .jtal-topics summary {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 9px 14px;
  }
  .jtal-topics:not([open]) .jtal-quick { display: none; }
  .jtal-quick {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: min(238px, 34dvh);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-top: 4px;
  }
  .jtal-quick-button { min-height: 42px; font-size: 0.72rem; }
  .jtal-message { max-width: 96%; }
  .jtal-note { padding: 7px 12px; font-size: 0.64rem; }
  .jtal-form { position: relative; z-index: 2; gap: 6px; padding: 9px 10px max(9px, env(safe-area-inset-bottom)); }
  .jtal-form-label { font-size: 0.7rem; }
  .jtal-input { font-size: 16px; }
  .jtal-submit { padding: 0 12px; }
  .jtal-clear { min-height: 24px; font-size: 0.7rem; }
}

.jtal-modal-open {
  scrollbar-gutter: stable;
}
@media (max-width: 360px) {
  .jtal-quick { grid-template-columns: 1fr; }
  .jtal-launcher { min-width: 76px; padding: 0 11px; }
}
@media (max-width: 900px) and (max-height: 560px) {
  .jtal-description,
  .jtal-note { display: none; }
  .jtal-header { padding: 10px 14px; }
  .jtal-quick {
    grid-template-columns: repeat(4, minmax(130px, 1fr));
    max-height: 88px;
    overflow: auto;
    padding: 8px;
  }
  .jtal-quick-button { min-height: 34px; }
  .jtal-messages { padding: 9px 12px; }
  .jtal-form { padding-top: 7px; }
}
@keyframes jtal-mobile-open {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .jtal-panel { animation: none; }
}
.jtal-launcher {
  width: 46px;
  min-width: 46px;
  max-width: 46px;
  height: 46px;
  min-height: 46px;
  padding: 0;
  overflow: hidden;
  white-space: nowrap;
  border-radius: 999px;
  font-size: 0;
  color: transparent;
}

.jtal-launcher.jt-floating-intro,
.jtal-launcher:hover,
.jtal-launcher:focus-visible {
  width: auto;
  min-width: 46px;
  max-width: min(210px, calc(100vw - 32px));
  padding: 0 18px 0 14px;
  border-radius: 999px;
  color: #fff;
  font-size: 0.84rem;
}
.jtal-launcher.jt-floating-intro::before,
.jtal-launcher:hover::before,
.jtal-launcher:focus-visible::before {
  margin-right:0;
}
@media (max-width: 560px) {
  .jtal-launcher {
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    width: 44px;
    min-width: 44px;
    max-width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
    border-radius: 50%;
    font-size: 0;
    color: transparent;
  }
  .jtal-launcher.jt-floating-intro,
  .jtal-launcher:hover,
  .jtal-launcher:focus-visible {
    width: auto;
    min-width: 44px;
    max-width: min(155px, calc(50vw - 18px));
    padding: 0 13px;
    border-radius: 999px;
    font-size: 0.76rem;
    color: #fff;
  }
  .jtal-launcher.jt-floating-intro::before,
  .jtal-launcher:hover::before,
  .jtal-launcher:focus-visible::before {
    margin-right:0;
  }
}

body.jtal-modal-open .jtal-launcher,
body.jtal-modal-open .jtpwa-launcher,
body.jtal-modal-open .jt-emergency-japa-fab {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}


.jtal-launcher {
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  width: 46px;
  min-width: 46px;
  max-width: 46px;
  height: 46px;
  min-height: 46px;
  padding: 0;
  border-radius: 999px;
  overflow: hidden;
  white-space: nowrap;
  transition: width 0.18s ease, max-width 0.18s ease, padding 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease, color 0.18s ease, font-size 0.18s ease;
}
.jtal-launcher.jt-floating-intro,
.jtal-launcher:hover,
.jtal-launcher:focus-visible {
  width: auto;
  min-width: 46px;
  max-width: min(210px, calc(100vw - 32px));
  padding: 0 18px 0 14px;
  border-radius: 999px;
}
@media (max-width: 560px) {
  .jtal-launcher {
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    width: 44px;
    min-width: 44px;
    max-width: 44px;
    height: 44px;
    min-height: 44px;
  }
  .jtal-launcher.jt-floating-intro,
  .jtal-launcher:hover,
  .jtal-launcher:focus-visible {
    width: auto;
    min-width: 44px;
    max-width: min(172px, calc(100vw - 28px));
    padding: 0 13px;
    border-radius: 999px;
  }
}

body.menu-open .jtal-launcher,body.menu-open .jtpwa-launcher,body.menu-open .jt-emergency-japa-fab,body.jtpwa-modal-open .jtal-launcher,body.jtpwa-modal-open .jt-emergency-japa-fab{opacity:0!important;visibility:hidden!important;pointer-events:none!important}
.jt-floating-label{display:inline-block;white-space:nowrap}.jt-action-icon{stroke:currentColor;fill:none}

/* final floating stack */

.jt-action-icon {
  width: 21px;
  height: 21px;
  display: block;
  flex: 0 0 auto;
  stroke: currentColor;
  fill: none;
}
.jt-floating-label,
.jt-emergency-japa-label {
  display: inline-block;
  white-space: nowrap;
}
.jtal-launcher,
.jt-emergency-japa-fab,
.jtpwa-launcher {
  left: auto !important;
  right: max(18px, env(safe-area-inset-right)) !important;
  width: 46px !important;
  min-width: 46px !important;
  max-width: 46px !important;
  height: 46px !important;
  min-height: 46px !important;
  padding: 0 !important;
  border-radius: 999px !important;
  overflow: hidden !important;
  white-space: nowrap !important;
  justify-content: center !important;
  gap: 8px !important;
  font-size: 0 !important;
  line-height: 1 !important;
  transition: width .18s ease, max-width .18s ease, padding .18s ease, opacity .18s ease, transform .18s ease, box-shadow .18s ease, color .18s ease, font-size .18s ease !important;
}
.jtal-launcher { bottom: max(18px, env(safe-area-inset-bottom)) !important; }
.jt-emergency-japa-fab { bottom: calc(max(18px, env(safe-area-inset-bottom)) + 56px) !important; }
.jtpwa-launcher { bottom: calc(max(18px, env(safe-area-inset-bottom)) + 112px) !important; }
.jtal-launcher.jt-floating-intro,
.jtal-launcher:hover,
.jtal-launcher:focus-visible,
.jt-emergency-japa-fab.jt-floating-intro,
.jt-emergency-japa-fab:hover,
.jt-emergency-japa-fab:focus-visible,
.jtpwa-launcher.jt-floating-intro,
.jtpwa-launcher:hover,
.jtpwa-launcher:focus-visible {
  width: auto !important;
  min-width: 46px !important;
  max-width: min(230px, calc(100vw - 36px)) !important;
  padding: 0 15px 0 13px !important;
  font-size: .84rem !important;
}
.jtal-launcher.jt-floating-intro .jt-floating-label,
.jtal-launcher:hover .jt-floating-label,
.jtal-launcher:focus-visible .jt-floating-label,
.jt-emergency-japa-fab.jt-floating-intro .jt-emergency-japa-label,
.jt-emergency-japa-fab:hover .jt-emergency-japa-label,
.jt-emergency-japa-fab:focus-visible .jt-emergency-japa-label,
.jtpwa-launcher.jt-floating-intro .jt-floating-label,
.jtpwa-launcher:hover .jt-floating-label,
.jtpwa-launcher:focus-visible .jt-floating-label {
  position: static !important;
  width: auto !important;
  height: auto !important;
  overflow: visible !important;
  clip: auto !important;
  opacity: 1 !important;
}
body.menu-open .jtal-launcher,
body.menu-open .jtpwa-launcher,
body.menu-open .jt-emergency-japa-fab,
body.jtal-modal-open .jtpwa-launcher,
body.jtal-modal-open .jt-emergency-japa-fab,
body.jtpwa-modal-open .jtal-launcher,
body.jtpwa-modal-open .jt-emergency-japa-fab,
body.jt-emergency-japa-open .jtal-launcher,
body.jt-emergency-japa-open .jtpwa-launcher {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}
@media (max-width: 560px) {
  .jtal-launcher,
  .jt-emergency-japa-fab,
  .jtpwa-launcher {
    right: 12px !important;
    width: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
  }
  .jtal-launcher { bottom: max(12px, env(safe-area-inset-bottom)) !important; }
  .jt-emergency-japa-fab { bottom: calc(max(12px, env(safe-area-inset-bottom)) + 52px) !important; }
  .jtpwa-launcher { bottom: calc(max(12px, env(safe-area-inset-bottom)) + 104px) !important; }
  .jtal-launcher.jt-floating-intro,
  .jtal-launcher:hover,
  .jtal-launcher:focus-visible,
  .jt-emergency-japa-fab.jt-floating-intro,
  .jt-emergency-japa-fab:hover,
  .jt-emergency-japa-fab:focus-visible,
  .jtpwa-launcher.jt-floating-intro,
  .jtpwa-launcher:hover,
  .jtpwa-launcher:focus-visible {
    width: auto !important;
    min-width: 44px !important;
    max-width: min(214px, calc(100vw - 28px)) !important;
    padding: 0 13px !important;
    font-size: .76rem !important;
  }
}

/* color-only floating buttons */
.jtal-launcher,
.jt-emergency-japa-fab,
.jtpwa-launcher {
  border: 1px solid rgba(255, 255, 255, .34) !important;
  color: #fff !important;
  text-shadow: none !important;
}
.jtal-launcher {
  background: linear-gradient(135deg, #4a0072, #6d1b9a) !important;
  box-shadow: 0 10px 26px rgba(74, 0, 114, .28) !important;
}
.jt-emergency-japa-fab {
  background: linear-gradient(135deg, #b85c00, #f59f00) !important;
  box-shadow: 0 10px 26px rgba(184, 92, 0, .28) !important;
}
.jtpwa-launcher {
  background: linear-gradient(135deg, #00695c, #00897b) !important;
  box-shadow: 0 10px 26px rgba(0, 105, 92, .28) !important;
}
.jt-floating-label,
.jt-emergency-japa-label {
  opacity: 0 !important;
}
.jtal-launcher.jt-floating-intro .jt-floating-label,
.jtal-launcher:hover .jt-floating-label,
.jtal-launcher:focus-visible .jt-floating-label,
.jt-emergency-japa-fab.jt-floating-intro .jt-emergency-japa-label,
.jt-emergency-japa-fab:hover .jt-emergency-japa-label,
.jt-emergency-japa-fab:focus-visible .jt-emergency-japa-label,
.jtpwa-launcher.jt-floating-intro .jt-floating-label,
.jtpwa-launcher:hover .jt-floating-label,
.jtpwa-launcher:focus-visible .jt-floating-label {
  opacity: 1 !important;
}

.jtal-launcher::before,
.jtpwa-launcher::before,
.jt-emergency-japa-fab::before,
.jtal-launcher svg,
.jtpwa-launcher svg,
.jt-emergency-japa-fab svg,
.jtal-launcher img,
.jtpwa-launcher img,
.jt-emergency-japa-fab img,
.jt-action-icon,
.jt-emergency-japa-icon {
  display: none !important;
  content: none !important;
  width: 0 !important;
  height: 0 !important;
  margin: 0 !important;
}

html {
  scrollbar-gutter: stable;
}

body.menu-open,
body.jtal-modal-open {
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding-right: 0 !important;
}
