/* Site-wide customer support widget (intentionally excluded from admin pages). */
.tw-support-widget {
  font-family: inherit;
  direction: rtl;
}

.tw-support-launcher {
  position: fixed;
  z-index: 9000;
  inset-inline-end: 22px;
  bottom: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-width: 132px;
  min-height: 52px;
  padding: 0 10px;
  border: 1px solid #365b4b;
  border-radius: 11px;
  background: linear-gradient(270deg, #547767, #294e3ede);
  color: #fff;
  font: inherit;
  font-weight: 600;
  box-shadow: 0 12px 35px rgba(31, 69, 51, .28);
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease;
}

.tw-support-launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 40px rgba(31, 69, 51, .33);
}

.tw-support-launcher:focus-visible,
.tw-support-panel button:focus-visible,
.tw-support-panel a:focus-visible {
  outline: 3px solid #a4cbb4;
  outline-offset: 3px;
}

.tw-support-icon {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(255, 255, 255, .6);
  border-radius: 50%;
  font-size: 15px;
}

.tw-support-panel {
  position: fixed;
  z-index: 9001;
  inset-inline-end: 22px;
  bottom: 86px;
  display: flex;
  flex-direction: column;
  width: min(390px, calc(100vw - 28px));
  height: min(560px, calc(100dvh - 125px));
  min-height: 300px;
  overflow: hidden;
  border: 1px solid #d5dfd8;
  border-radius: 20px;
  background: #fff;
  color: #16221b;
  box-shadow: 0 24px 70px rgba(11, 32, 21, .24);
}

.tw-support-panel[hidden] {
  display: none !important;
}

.tw-support-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  background: #f0f5f1;
  border-bottom: 1px solid #dbe5de;
}

.tw-support-panel-title {
  margin: 0;
  font-size: 1rem;
  color: #193a2b;
}

.tw-support-panel-subtitle {
  display: block;
  margin-top: 3px;
  color: #67776d;
  font-size: .78rem;
  font-weight: 500;
}

.tw-support-close {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 1px solid #d0ddd4;
  border-radius: 10px;
  background: #fff;
  color: #284b3a;
  font-size: 1.1rem;
  cursor: pointer;
}

.tw-support-login-required {
  padding: 22px 18px;
  line-height: 1.9;
  color: #44564a;
}

.tw-support-login-required p {
  margin: 0 0 12px;
}

.tw-support-login-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 15px;
  border-radius: 10px;
  background: #365f4b;
  color: #fff !important;
  text-decoration: none;
  font-weight: 800;
}

.tw-support-thread {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  gap: 10px;
  overflow: auto;
  padding: 14px;
  background: linear-gradient(180deg, #fbfdfb, #f6f8f6);
}

.tw-support-empty {
  margin: auto;
  padding: 16px;
  text-align: center;
  color: #79867d;
  line-height: 1.9;
}

.tw-support-message {
  display: flex;
  flex-direction: column;
  max-width: 88%;
  gap: 5px;
  align-self: flex-start;
}

.tw-support-message.is-customer {
  align-self: flex-end;
}

.tw-support-bubble {
  padding: 10px 12px;
  border: 1px solid #e2e8e3;
  border-radius: 14px 14px 4px 14px;
  background: #fff;
  color: #26372c;
  line-height: 1.8;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.tw-support-message.is-customer .tw-support-bubble {
  border-color: #c5dbc9;
  border-radius: 14px 14px 14px 4px;
  background: #e9f3ec;
}

.tw-support-time {
  color: #89948c;
  font-size: .7rem;
  padding: 0 4px;
}

.tw-support-compose {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid #e3e9e4;
  background: #fff;
}

.tw-support-compose textarea {
  width: 100%;
  min-height: 45px;
  max-height: 100px;
  resize: vertical;
  border: 1px solid #d5dfd8;
  border-radius: 12px;
  padding: 10px 11px;
  color: #19261d;
  background: #fff;
  font: inherit;
  font-size: .9rem;
  box-sizing: border-box;
}

.tw-support-send {
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  background: #3d6651;
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.tw-support-send:disabled {
  opacity: .55;
  cursor: wait;
}

.tw-support-status {
  padding: 0 12px 8px;
  margin: 0;
  min-height: 0;
  color: #9a3c35;
  font-size: .82rem;
  background: #fff;
}

.tw-support-status:empty {
  display: none;
}

.tw-support-status.is-error {
  color: #9a3c35;
}

@media (max-width: 560px) {
  .tw-support-launcher {
    inset-inline-end: 14px;
    bottom: 14px;
    min-width: 118px;
    min-height: 48px;
  }

  .tw-support-panel {
    inset-inline-end: 10px;
    bottom: 72px;
    width: calc(100vw - 20px);
    height: min(570px, calc(100dvh - 100px));
    border-radius: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tw-support-launcher {
    transition: none;
  }
}

/* Theme-aware palette: classic = charcoal/gold, emerald = white/green. */
html[data-theme="classic"] #twSupportWidget {
  --tw-support-panel-bg: #111214;
  --tw-support-panel-text: #f2eee2;
  --tw-support-panel-border: #51452a;
  --tw-support-header-bg: #191a1d;
  --tw-support-header-border: #383124;
  --tw-support-muted: #b8b2a3;
  --tw-support-thread-bg: linear-gradient(180deg, #141518, #101113);
  --tw-support-bubble-bg: #222326;
  --tw-support-bubble-border: #414044;
  --tw-support-customer-bg: #332a16;
  --tw-support-customer-border: #76602b;
  --tw-support-accent: #18543a;
  --tw-support-accent-strong: #f0cd75;
  --tw-support-compose-bg: #17181b;
  --tw-support-input-bg: #202124;
  --tw-support-input-text: #f8f4e8;
  --tw-support-focus: #f0cd75;
}

html[data-theme="emerald"] #twSupportWidget,
html:not([data-theme]) #twSupportWidget {
  --tw-support-panel-bg: #fff;
  --tw-support-panel-text: #16221b;
  --tw-support-panel-border: #d5dfd8;
  --tw-support-header-bg: #f0f5f1;
  --tw-support-header-border: #dbe5de;
  --tw-support-muted: #67776d;
  --tw-support-thread-bg: linear-gradient(180deg, #fbfdfb, #f6f8f6);
  --tw-support-bubble-bg: #fff;
  --tw-support-bubble-border: #e2e8e3;
  --tw-support-customer-bg: #e9f3ec;
  --tw-support-customer-border: #c5dbc9;
  --tw-support-accent: #557568;
  --tw-support-accent-strong: #3f6255;
  --tw-support-compose-bg: #fff;
  --tw-support-input-bg: #fff;
  --tw-support-input-text: #19261d;
  --tw-support-focus: #78a88b;
}

#twSupportWidget .tw-support-launcher {
  border-color: var(--tw-support-panel-border, #365b4b);
  color: #fff;
  box-shadow: 0 12px 35px rgba(0, 0, 0, .28);
}

html[data-theme="classic"] #twSupportWidget .tw-support-launcher {
  color: #17140d;
  border-color: #8e7133;
  background: linear-gradient(135deg, #f0cd75, #b78c37);
  box-shadow: 0 12px 35px rgba(0, 0, 0, .45), 0 0 0 1px rgba(217, 181, 92, .12);
}

#twSupportWidget .tw-support-panel {
  border-color: var(--tw-support-panel-border, #d5dfd8);
  background: var(--tw-support-panel-bg, #fff);
  color: var(--tw-support-panel-text, #16221b);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .3);
}

#twSupportWidget .tw-support-panel-header {
  background: var(--tw-support-header-bg, #f0f5f1);
  border-bottom-color: var(--tw-support-header-border, #dbe5de);
}

#twSupportWidget .tw-support-panel-title {
  color: var(--tw-support-panel-text, #193a2b);
}

#twSupportWidget .tw-support-panel-subtitle,
#twSupportWidget .tw-support-login-required {
  color: var(--tw-support-muted, #67776d);
}

#twSupportWidget .tw-support-close {
  border-color: var(--tw-support-panel-border, #d0ddd4);
  background: var(--tw-support-panel-bg, #fff);
  color: var(--tw-support-panel-text, #284b3a);
}

#twSupportWidget .tw-support-login-link,
#twSupportWidget .tw-support-send {
  background: linear-gradient(316deg, var(--gold-light), var(--gold-2));
  color: #fff !important;
}

html[data-theme="classic"] #twSupportWidget .tw-support-login-link,
html[data-theme="classic"] #twSupportWidget .tw-support-send {
  color: #17140d !important;
  font-weight: 900;
}

#twSupportWidget .tw-support-thread {
  background: var(--tw-support-thread-bg, #f6f8f6);
}

#twSupportWidget .tw-support-empty {
  color: var(--tw-support-muted, #79867d);
}

#twSupportWidget .tw-support-bubble {
  border-color: var(--tw-support-bubble-border, #e2e8e3);
  background: var(--tw-support-bubble-bg, #fff);
  color: var(--tw-support-panel-text, #26372c);
}

#twSupportWidget .tw-support-message.is-customer .tw-support-bubble {
  border-color: var(--tw-support-customer-border, #c5dbc9);
  background: var(--tw-support-customer-bg, #e9f3ec);
}

#twSupportWidget .tw-support-time {
  color: var(--tw-support-muted, #89948c);
}

#twSupportWidget .tw-support-compose {
  border-top-color: var(--tw-support-panel-border, #e3e9e4);
  background: var(--tw-support-compose-bg, #fff);
}

#twSupportWidget .tw-support-compose textarea {
  border-color: var(--tw-support-panel-border, #d5dfd8);
  background: var(--tw-support-input-bg, #fff);
  color: var(--tw-support-input-text, #19261d);
}

#twSupportWidget .tw-support-compose textarea::placeholder {
  color: var(--tw-support-muted, #67776d);
}

#twSupportWidget .tw-support-status {
  background: var(--tw-support-compose-bg, #fff);
}

#twSupportWidget .tw-support-launcher:focus-visible,
#twSupportWidget .tw-support-panel button:focus-visible,
#twSupportWidget .tw-support-panel a:focus-visible,
#twSupportWidget .tw-support-compose textarea:focus-visible {
  outline-color: var(--tw-support-focus, #a4cbb4);
}