.star-auto-assistant {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 2147482400;
  width: min(380px, calc(100vw - 32px));
  pointer-events: none;
  color: #f8fafc;
  font-family: Arial, Helvetica, sans-serif;
}

.star-auto-assistant-panel[hidden] {
  display: none !important;
}

.star-auto-assistant-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 12px);
  width: 100%;
  max-height: min(640px, calc(100vh - 118px));
  display: grid;
  grid-template-rows: auto minmax(120px, 1fr) auto auto auto;
  overflow: hidden;
  border: 1px solid rgba(242, 195, 0, 0.38);
  border-radius: 18px;
  background: #111827;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.46);
  pointer-events: auto;
}

.star-auto-assistant.is-footer-near {
  top: max(10px, env(safe-area-inset-top));
  right: max(4px, env(safe-area-inset-right));
  bottom: auto;
}

.star-auto-assistant.is-footer-near .star-auto-assistant-panel {
  top: calc(100% + 12px);
  bottom: auto;
}

.star-auto-assistant.is-footer-near:not(.is-open) .star-auto-assistant-trigger {
  width: 50px;
  min-width: 50px;
  padding: 4px;
  gap: 0;
}

.star-auto-assistant.is-footer-near:not(.is-open)
  .star-auto-assistant-trigger
  > span:last-child {
  display: none;
}

.star-auto-assistant-header {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 36px;
  gap: 10px;
  align-items: center;
  padding: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background:
    radial-gradient(circle at 0 0, rgba(242, 195, 0, 0.18), transparent 46%),
    #0b1020;
}

.star-auto-assistant-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #111827;
  background: #f2c300;
  box-shadow: 0 8px 20px rgba(242, 195, 0, 0.2);
}

.star-auto-assistant-header h2 {
  margin: 0;
  color: #ffffff;
  font-size: 1.05rem;
  font-weight: 950;
  line-height: 1.1;
}

.star-auto-assistant-header p {
  margin: 4px 0 0;
  color: #cbd5e1;
  font-size: 0.72rem;
  line-height: 1.2;
}

.star-auto-assistant-header p span {
  width: 7px;
  height: 7px;
  display: inline-block;
  margin-right: 4px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.14);
}

.star-auto-assistant-close {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 10px;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.07);
  cursor: pointer;
}

.star-auto-assistant-close:hover,
.star-auto-assistant-close:focus-visible {
  color: #111827;
  background: #f2c300;
}

.star-auto-assistant-messages {
  min-height: 152px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 14px;
  background: #151b2a;
  scrollbar-width: thin;
}

.star-auto-assistant-message {
  width: fit-content;
  max-width: 92%;
  padding: 10px 11px;
  border-radius: 13px 13px 13px 4px;
  color: #e5e7eb;
  background: #252d40;
  font-size: 0.82rem;
  line-height: 1.42;
}

.star-auto-assistant-message.is-customer {
  align-self: flex-end;
  border-radius: 13px 13px 4px 13px;
  color: #111827;
  background: #f2c300;
}

.star-auto-assistant-message p {
  margin: 0;
}

.star-auto-assistant-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 9px;
}

.star-auto-assistant-actions a {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 10px;
  border: 1px solid rgba(242, 195, 0, 0.52);
  border-radius: 9px;
  color: #f8fafc;
  background: rgba(242, 195, 0, 0.09);
  font-size: 0.7rem;
  font-weight: 900;
  line-height: 1.1;
  text-decoration: none;
  text-transform: uppercase;
}

.star-auto-assistant-actions a:hover,
.star-auto-assistant-actions a:focus-visible {
  color: #111827;
  background: #f2c300;
}

.star-auto-assistant-topics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  padding: 12px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: #111827;
}

.star-auto-assistant-topics button {
  min-width: 0;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
  padding: 8px 9px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 10px;
  color: #e2e8f0;
  background: rgba(30, 41, 59, 0.78);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.15;
  text-align: left;
  cursor: pointer;
}

.star-auto-assistant-topics button i {
  flex: 0 0 16px;
  color: #f2c300;
  text-align: center;
}

.star-auto-assistant-topics button:hover,
.star-auto-assistant-topics button:focus-visible {
  border-color: #f2c300;
  color: #ffffff;
  background: rgba(242, 195, 0, 0.12);
}

.star-auto-assistant-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px;
  gap: 8px;
  padding: 0 14px 10px;
  background: #111827;
}

.star-auto-assistant-form input {
  min-width: 0;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid rgba(148, 163, 184, 0.38);
  border-radius: 11px;
  outline: 0;
  color: #f8fafc;
  background: #0b1020;
  font: inherit;
  font-size: 0.78rem;
}

.star-auto-assistant-form input::placeholder {
  color: #94a3b8;
}

.star-auto-assistant-form input:focus {
  border-color: #f2c300;
  box-shadow: 0 0 0 3px rgba(242, 195, 0, 0.13);
}

.star-auto-assistant-form button {
  width: 40px;
  min-height: 40px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 11px;
  color: #111827;
  background: #f2c300;
  cursor: pointer;
}

.star-auto-assistant-form button:hover,
.star-auto-assistant-form button:focus-visible {
  background: #ffe05a;
}

.star-auto-assistant-note {
  margin: 0;
  padding: 0 14px 12px;
  color: #94a3b8;
  background: #111827;
  font-size: 0.64rem;
  line-height: 1.3;
  text-align: center;
}

.star-auto-assistant-trigger {
  min-height: 58px;
  width: fit-content;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  margin-left: auto;
  padding: 8px 15px 8px 9px;
  border: 1px solid rgba(242, 195, 0, 0.62);
  border-radius: 999px;
  color: #ffffff;
  background: #111827;
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.36);
  pointer-events: auto;
  cursor: pointer;
}

.star-auto-assistant-trigger:hover,
.star-auto-assistant-trigger:focus-visible,
.star-auto-assistant.is-open .star-auto-assistant-trigger {
  border-color: #f2c300;
  background: #1e293b;
  transform: translateY(-1px);
}

.star-auto-assistant-trigger-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  flex: 0 0 40px;
  border-radius: 50%;
  color: #111827;
  background: #f2c300;
}

.star-auto-assistant-trigger > span:last-child {
  display: grid;
  gap: 2px;
  text-align: left;
}

.star-auto-assistant-trigger strong {
  color: #ffffff;
  font-size: 0.84rem;
  font-weight: 950;
  line-height: 1.1;
}

.star-auto-assistant-trigger small {
  color: #cbd5e1;
  font-size: 0.67rem;
  line-height: 1.1;
}

html[data-customer-theme="light"] .star-auto-assistant-panel {
  border-color: rgba(15, 23, 42, 0.18);
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
}

html[data-customer-theme="light"] .star-auto-assistant-messages {
  background: #f1f5f9;
}

html[data-customer-theme="light"] .star-auto-assistant-message {
  color: #1f2937;
  background: #ffffff;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.08);
}

html[data-customer-theme="light"] .star-auto-assistant-message.is-customer {
  color: #111827;
  background: #f2c300;
}

html[data-customer-theme="light"] .star-auto-assistant-actions a {
  color: #1f2937;
}

html[data-customer-theme="light"] .star-auto-assistant-topics,
html[data-customer-theme="light"] .star-auto-assistant-form,
html[data-customer-theme="light"] .star-auto-assistant-note {
  border-color: #e2e8f0;
  background: #ffffff;
}

html[data-customer-theme="light"] .star-auto-assistant-topics button {
  color: #334155;
  border-color: #cbd5e1;
  background: #f8fafc;
}

html[data-customer-theme="light"] .star-auto-assistant-form input {
  color: #111827;
  border-color: #cbd5e1;
  background: #ffffff;
}

html[data-customer-theme="light"] .star-auto-assistant-note {
  color: #64748b;
}

@media (max-width: 520px) {
  .star-auto-assistant {
    left: 10px;
    right: 10px;
    bottom: 10px;
    width: auto;
    max-width: none;
  }

  .star-auto-assistant.is-footer-near {
    top: max(10px, env(safe-area-inset-top));
    right: max(4px, env(safe-area-inset-right));
    bottom: auto;
  }

  .star-auto-assistant-panel {
    max-height: calc(100vh - 88px);
    border-radius: 16px;
  }

  .star-auto-assistant-trigger {
    min-height: 54px;
    padding-right: 13px;
  }

  .star-auto-assistant-trigger-icon {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
  }

  .star-auto-assistant.is-footer-near:not(.is-open) .star-auto-assistant-trigger {
    width: 50px;
    min-width: 50px;
    padding: 6px;
  }

  .star-auto-assistant-topics {
    gap: 6px;
    padding: 10px 12px;
  }

  .star-auto-assistant-messages {
    min-height: 130px;
  }
}

@media print {
  .star-auto-assistant {
    display: none !important;
  }
}
