.chat-launcher {
  position: fixed;
  right: 24px;
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 1200;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: calc(100vw - 32px);
  padding: 0;
  border: 0;
  background: transparent;
  color: #0a2948;
  font: 500 0.85rem "Inter", "Segoe UI", sans-serif;
  text-align: left;
  cursor: pointer;
}
.chat-launcher[hidden] { display: none; }
.chat-launcher:focus-visible {
  outline: 3px solid #268a36;
  outline-offset: 6px;
  border-radius: 22px;
}
.chat-launcher-balloon {
  position: relative;
  padding: 13px 16px;
  border: 1px solid #d5e5dc;
  border-radius: 18px 18px 4px 18px;
  background: #fff;
  box-shadow: 0 8px 28px #071c361a;
}
.chat-launcher-balloon::after {
  content: "";
  position: absolute;
  right: -6px;
  bottom: 14px;
  width: 10px;
  height: 10px;
  border-top: 1px solid #d5e5dc;
  border-right: 1px solid #d5e5dc;
  background: #fff;
  transform: rotate(45deg);
}
.chat-launcher-balloon strong {
  display: block;
  margin-bottom: 4px;
  color: #237834;
  font-size: 0.75rem;
  font-weight: 800;
}
.chat-launcher-mascot {
  display: block;
  flex: 0 0 auto;
  width: 112px;
  height: 112px;
  border-radius: 24px;
  background: #fff;
  object-fit: contain;
  box-shadow: 0 8px 28px #071c361a;
  pointer-events: none;
}
.chat-launcher:hover .chat-launcher-balloon { border-color: #8fbd98; }

.chat-footer { padding: 12px 16px; border-top: 1px solid #dbe8df; background: #fff; flex-shrink: 0; }
.chat-composer[hidden] { display: none; }
.chat-composer label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 6px; }
.chat-composer > div { display: flex; gap: 8px; }
.chat-composer input { min-width: 0; flex: 1; padding: 10px; border: 1px solid #bdd2c5; border-radius: 8px; font: inherit; }
.chat-composer input:focus { outline: 2px solid #2f8058; outline-offset: 1px; }
.chat-footer .chat-status:empty { display: none; }
.chat-actions[inert] { opacity: .7; }
.chat-panel {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1300;
  width: min(430px, calc(100vw - 32px));
  height: min(720px, calc(100vh - 48px));
  height: min(720px, calc(100dvh - 48px));
  overflow: hidden;
  border: 1px solid #d5e2ed;
  border-radius: 22px;
  background: #f4f8fb;
  box-shadow: 0 28px 70px rgba(7, 28, 54, 0.28);
}
.chat-panel:not([hidden]) {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}
.chat-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 11px;
  padding: 14px 16px;
  background: #071c36;
  color: #fff;
}
.chat-header strong,
.chat-header small {
  display: block;
}
.chat-header small {
  margin-top: 2px;
  color: #c8d8e6;
  font-size: 0.72rem;
}
.chat-header > button {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
  font-size: 1.45rem;
  cursor: pointer;
}
.chat-avatar {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #fff;
}
.chat-avatar img {
  width: 36px;
}
.chat-conversation {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
}
.chat-messages {
  padding: 18px 16px;
}
.chat-bubble {
  overflow-wrap: anywhere;
  max-width: 88%;
  margin: 0 0 12px;
  padding: 11px 13px;
  border-radius: 15px;
  background: #fff;
  color: #15243a;
  font-size: 0.88rem;
  line-height: 1.45;
  box-shadow: 0 5px 18px rgba(7, 28, 54, 0.07);
  white-space: pre-line;
}
.chat-bubble.user {
  margin-left: auto;
  background: #dff6d8;
}
.chat-bubble.error {
  border: 1px solid #efb3ba;
  background: #fff2f4;
  color: #a91f35;
}
.chat-actions {
  padding: 14px 16px;
  border-top: 1px solid #d8e3ec;
  background: #fff;
}
.chat-actions:empty {
  display: none;
}
.chat-actions h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}
.chat-actions p {
  margin: 6px 0 12px;
  color: #607087;
  font-size: 0.82rem;
}
.chat-choice-grid {
  display: grid;
  gap: 8px;
}
.chat-button {
  min-height: 44px;
  padding: 9px 13px;
  border: 1px solid #cddbe7;
  border-radius: 10px;
  background: #fff;
  color: #0b2845;
  font-weight: 800;
  cursor: pointer;
}
.chat-button.primary {
  border-color: #2dac1d;
  background: #2dac1d;
  color: #fff;
}
.chat-button.danger {
  border-color: #edc0c6;
  color: #bc263a;
}
.chat-button:disabled {
  opacity: 0.6;
  cursor: wait;
}
.chat-form {
  display: grid;
  gap: 9px;
}
.chat-form.two-columns {
  grid-template-columns: 1fr 1fr;
}
.chat-form label {
  display: grid;
  gap: 5px;
  color: #10233c;
  font-size: 0.77rem;
  font-weight: 750;
}
.chat-form label.full,
.chat-form .full {
  grid-column: 1/-1;
}
.chat-form input,
.chat-form select,
.chat-form textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 10px;
  border: 1px solid #cfdce7;
  border-radius: 9px;
  background: #fff;
  color: #10233c;
  font: inherit;
}
.chat-form input[type="checkbox"],
.chat-form input[type="radio"] {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  min-height: 0;
  padding: 0;
  accent-color: #239b16;
  cursor: pointer;
}
.chat-check-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  cursor: pointer;
}
.chat-form textarea {
  min-height: 64px;
  resize: vertical;
}
.chat-form input:focus,
.chat-form select:focus,
.chat-form textarea:focus {
  outline: 3px solid rgba(17, 156, 228, 0.13);
  border-color: #119ce4;
}
.chat-inline-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.chat-inline-actions > * {
  flex: 1;
}
.chat-item-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}
.chat-item-card {
  position: relative;
  min-width: 0;
  overflow-wrap: anywhere;
  padding: 10px 38px 10px 11px;
  border: 1px solid #d7e3ec;
  border-radius: 10px;
  background: #f8fbfd;
}
.chat-conversation-tools { display: flex; flex-direction: column; gap: 8px; }
.chat-conversation-tools .compact { padding: 10px 12px; }
.chat-secondary summary { padding: 8px 4px; cursor: pointer; color: #16466b; font-size: .8rem; }
.chat-secondary .chat-link { display: block; width: 100%; text-align: left; }
.chat-link { border: 0; background: none; color: #16466b; text-decoration: underline; cursor: pointer; font: inherit; font-size: .78rem; padding: 8px 4px; min-height: 36px; }
.chat-attach { position: relative; display: block; text-align: center; overflow: hidden; }
.chat-attach input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.chat-attach:focus-within { outline: 2px solid #16466b; outline-offset: 2px; }
.chat-item-card input[type="file"] {
  width: 100%;
  min-width: 0;
}
.chat-item-card strong,
.chat-item-card small {
  display: block;
}
.chat-item-card small {
  margin-top: 3px;
  color: #64748b;
}
.chat-item-card .chat-remove-item {
  position: absolute;
  right: 7px;
  top: 7px;
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  color: #bd263a;
  font-size: 1.1rem;
  cursor: pointer;
}
.chat-photo-note {
  display: block;
  margin-top: 5px;
  color: #278019 !important;
  font-weight: 700;
}
.chat-photo-note.missing {
  color: #53685d !important;
}
.chat-photo-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}
.chat-photo-tools[hidden] {
  display: none;
}
.chat-photo-tools .chat-photo-note {
  flex: 1;
  margin-top: 0;
}
.chat-photo-view {
  flex: 0 0 auto;
  padding: 5px 8px;
  border: 1px solid #bfd5e5;
  border-radius: 7px;
  background: #fff;
  color: #0b4771;
  font-size: 0.72rem;
  font-weight: 800;
  cursor: pointer;
}
.chat-photo-view:hover {
  border-color: #119ce4;
  background: #eef9ff;
}
.chat-company {
  display: block;
  padding: 11px;
  border: 1px solid #d4e1eb;
  border-radius: 11px;
  cursor: pointer;
}
.chat-company:has(input:checked) {
  border-color: #35b624;
  background: #f2fced;
}
.chat-company input {
  grid-row: 1 / 3;
  align-self: center;
  margin: 0;
}
.chat-company > span {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 3px 9px;
}
.chat-company strong,
.chat-company small {
  grid-column: 2;
  display: block;
  margin-left: 0;
}
.chat-company small {
  margin-top: 3px;
  color: #607087;
}
.chat-summary {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}
.chat-summary > div {
  padding: 9px 10px;
  border-radius: 9px;
  background: #f4f8fb;
  font-size: 0.82rem;
}
.chat-google {
  margin-top: 8px;
}
.chat-google .google-button-host {
  display: flex;
  justify-content: center;
}
.chat-google .google-phone-form {
  padding: 10px;
  border: 1px solid #d4e1eb;
  border-radius: 10px;
}
.chat-google .google-phone-form label {
  display: grid;
  gap: 4px;
  font-size: 0.78rem;
  font-weight: 700;
}
.chat-google .google-phone-form input {
  height: 42px;
  padding: 8px;
  border: 1px solid #cfdce7;
  border-radius: 8px;
}
.chat-google .google-phone-form button {
  width: 100%;
  min-height: 42px;
  margin-top: 8px;
  border: 0;
  border-radius: 8px;
  background: #0b4771;
  color: #fff;
  font-weight: 800;
}
.chat-status {
  min-height: 18px;
  margin: 2px 0 !important;
  color: #bd263a !important;
}
.chat-status.success {
  color: #208417 !important;
}
.chat-image-viewer {
  width: min(760px, calc(100vw - 32px));
  max-height: min(86dvh, 760px);
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 18px;
  background: #f4f8fb;
  color: #10233c;
  box-shadow: 0 28px 80px rgba(7, 28, 54, 0.36);
}
.chat-image-viewer::backdrop {
  background: rgba(4, 19, 37, 0.72);
  backdrop-filter: blur(3px);
}
.chat-image-viewer > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  background: #071c36;
  color: #fff;
}
.chat-image-viewer h3 {
  margin: 0;
  font-size: 1rem;
}
.chat-image-viewer [data-close-image] {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 1.4rem;
  cursor: pointer;
}
.chat-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  max-height: calc(86dvh - 64px);
  padding: 16px;
  overflow-y: auto;
}
.chat-image-grid figure {
  margin: 0;
  overflow: hidden;
  border: 1px solid #d5e2ed;
  border-radius: 12px;
  background: #fff;
}
.chat-image-grid img {
  display: block;
  width: 100%;
  height: min(48dvh, 420px);
  object-fit: contain;
  background: #e7eef4;
}
.chat-image-grid figcaption {
  padding: 8px 10px;
  overflow: hidden;
  color: #51647a;
  font-size: 0.75rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 600px) {
  .chat-launcher {
    right: 16px;
    bottom: max(16px, env(safe-area-inset-bottom));
    gap: 10px;
  }
  .chat-launcher-balloon { padding: 11px 12px; font-size: 0.78rem; }
  .chat-launcher-mascot { width: 84px; height: 84px; border-radius: 20px; }
  .chat-panel {
    inset: 10px;
    width: auto;
    height: auto;
    border-radius: 18px;
  }
  .chat-form.two-columns {
    grid-template-columns: 1fr;
  }
  .chat-form label.full,
  .chat-form .full {
    grid-column: auto;
  }
  .chat-image-viewer {
    width: calc(100vw - 20px);
    max-height: calc(100dvh - 20px);
  }
  .chat-image-grid {
    grid-template-columns: 1fr;
    max-height: calc(100dvh - 84px);
  }
  .chat-image-grid img {
    height: min(58dvh, 460px);
  }
}
.chat-options { position: relative; }
.chat-options[hidden] { display: none; }
.chat-options summary { display: grid; place-items: center; width: 36px; height: 36px; cursor: pointer; list-style: none; border-radius: 9px; background: rgba(255,255,255,.09); font-size: 24px; }
.chat-options summary::-webkit-details-marker { display: none; }
.chat-options-menu { position: absolute; top: 42px; right: 0; z-index: 2; width: 220px; padding: 6px; border: 1px solid #d5e2ed; border-radius: 12px; background: white; box-shadow: 0 8px 24px #071c3630; color: #15243a; }
.chat-options-menu button, .chat-options-menu a { display: block; width: 100%; padding: 10px; border: 0; border-radius: 7px; background: transparent; color: #15243a; text-align: left; text-decoration: none; font: inherit; font-size: 13px; cursor: pointer; }
.chat-options-menu button:hover, .chat-options-menu a:hover { background: #edf5fa; }
.chat-options-menu small { padding: 8px 10px; color: #53685d; font-size: 11px; }
.chat-options summary:focus-visible, .chat-options-menu :focus-visible { outline: 2px solid #55baf2; outline-offset: 2px; }
#chatClose { grid-column: 4; }
