.support-widget {
  position: fixed;
  right: max(22px, env(safe-area-inset-right));
  bottom: max(22px, env(safe-area-inset-bottom));
  z-index: 13000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

.support-widget-launcher {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 54px;
  padding: 0 19px;
  border: 1px solid #064da7;
  border-radius: 999px;
  color: #000;
  background: linear-gradient(135deg, #e4f0ff, #d8f4ef);
  box-shadow: 0 10px 30px #0b315433;
  font: 700 14px/1.2 Inter, "Segoe UI", Arial, sans-serif;
  cursor: pointer;
}

.support-widget-launcher[hidden] { display: none !important; }

.support-widget-launcher:hover,
.support-widget-launcher:focus-visible {
  color: #000;
  background: linear-gradient(135deg, #d4e7ff, #c8eee7);
  outline: 3px solid #a9d7ff;
  outline-offset: 2px;
}

.support-widget-icon {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid #00000055;
  border-radius: 50%;
  font-size: 13px;
}

.support-widget-badge,
.support-inbox-unread {
  display: inline-flex;
  min-width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  border-radius: 999px;
  color: #fff;
  background: #c2413b;
  font-size: 11px;
  font-weight: 800;
}

.support-widget-badge[hidden] { display: none; }

.support-chat-window {
  position: relative;
  display: flex;
  width: min(400px, calc(100vw - 28px));
  height: min(540px, calc(100dvh - 100px));
  min-height: 340px;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #d6e1ed;
  border-radius: 20px;
  color: #000;
  background: #fff;
  box-shadow: 0 20px 60px #10294432;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

.support-chat-window[hidden] { display: none !important; }

.support-chat-header {
  display: flex;
  min-height: 78px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 17px;
  color: #000;
  background: linear-gradient(120deg, #dcecff, #d8f4ef);
}

.support-chat-heading h2 {
  margin: 0;
  color: #000;
  font-size: 17px;
  font-weight: 750;
  line-height: 1.25;
}

.support-chat-heading p {
  margin: 4px 0 0;
  color: #000;
  font-size: 12px;
}

#root main.support-chat-page .support-chat-heading h2 { color: #000 !important; }
#root main.support-chat-page .support-chat-heading p { color: #000 !important; }

.support-chat-header-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.support-chat-connection {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #000;
  font-size: 10px;
  white-space: nowrap;
}

.support-chat-connection::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fecf78;
  content: "";
}

.support-chat-connection.is-online::before { background: #8bf0bd; }

.support-chat-minimize {
  padding: 3px 0;
  border: 0;
  color: #000;
  background: transparent;
  font: 600 11px Inter, "Segoe UI", Arial, sans-serif;
  cursor: pointer;
}

.support-chat-minimize:hover { color: #000; text-decoration: underline; }

.support-chat-controls { display: flex; align-items: center; gap: 9px; }
.support-chat-close { display: grid; width: 27px; height: 27px; place-items: center; padding: 0; border: 1px solid #00000055; border-radius: 50%; color: #000; background: #ffffff80; font: 20px/1 Arial, sans-serif; cursor: pointer; }
.support-chat-close:hover,.support-chat-close:focus-visible { color: #000; background: #fff; outline: 2px solid #bfe0ff; }

.support-chat-history {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-bottom: 1px solid #e4eaf1;
  background: #fff;
}

.support-chat-history[hidden] { display: none !important; }
.support-chat-history label { flex: 0 0 auto; margin: 0; color: #000; font-size: 11px; font-weight: 650; }
.support-chat-history select { box-sizing: border-box; min-width: 0; min-height: 34px; flex: 1 1 auto; padding: 5px 9px; border: 1px solid #d5deea; border-radius: 8px; color: #000; background: #fff; font: 11px Inter, "Segoe UI", Arial, sans-serif; }
#root main.support-chat-page .support-chat-history select { min-height: 34px !important; margin: 0 !important; padding: 5px 9px !important; border: 1px solid #d5deea !important; border-radius: 8px !important; font: 11px Inter, "Segoe UI", Arial, sans-serif !important; }

.support-chat-messages {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 11px;
  min-height: 0;
  overflow: auto;
  padding: 18px 14px;
  background: linear-gradient(#f7faff, #f2f7fc);
  overscroll-behavior: contain;
}

.support-chat-empty {
  align-self: center;
  max-width: 260px;
  margin: auto;
  color: #000;
  font-size: 13px;
  line-height: 1.55;
  text-align: center;
}

.support-chat-message,
.support-inbox-message {
  width: fit-content;
  max-width: min(88%, 510px);
  padding: 10px 13px;
  border: 1px solid #dce5ee;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 2px 7px #1532520a;
}

.support-chat-message { color: #000; }
.support-inbox-message { color: #21364d; }

.support-chat-message.is-admin { align-self: flex-start; border-bottom-left-radius: 5px; }
.support-chat-message.is-user { align-self: flex-end; border-color: #c9ddfb; border-bottom-right-radius: 5px; background: #eaf3ff; }

.support-chat-message-meta,
.support-inbox-message-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 12px;
  margin-bottom: 5px;
  font-size: 11px;
}

.support-chat-message-meta { color: #000; }
.support-inbox-message-meta { color: #40566e; }

.support-chat-message-meta time { color: #000; font-size: 10px; }
.support-inbox-message-meta time { color: #75859a; font-size: 10px; }

.support-chat-message p,
.support-inbox-message p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.support-chat-message p { color: #000; }
.support-inbox-message p { color: #1e344a; }

.support-chat-feedback {
  min-height: 20px;
  margin: 0;
  padding: 2px 15px;
  color: #000;
  font-size: 11px;
}

.support-chat-feedback.is-success,
.support-chat-feedback.is-error { color: #000; }

.support-chat-composer,
.support-inbox-composer {
  display: flex;
  align-items: flex-end;
  gap: 9px;
  margin: 0;
  padding: 12px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid #e4eaf1;
  background: #fff;
}

#root main.support-chat-page .support-chat-composer,
#root main.admin-support-page .support-inbox-composer {
  display: flex !important;
  grid-template-columns: none !important;
  gap: 9px !important;
  margin: 0 !important;
  padding: 12px !important;
  border: 0 !important;
  border-top: 1px solid #e4eaf1 !important;
  border-radius: 0 !important;
  background: #fff !important;
}

.support-chat-composer textarea,
.support-inbox-composer textarea {
  box-sizing: border-box;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 44px;
  max-height: 120px;
  padding: 10px 12px;
  border: 1px solid #cbd7e4;
  border-radius: 14px;
  background: #fff;
  font: 13px/1.45 Inter, "Segoe UI", Arial, sans-serif;
  resize: vertical;
}

.support-chat-composer textarea {
  color: #000;
  -webkit-text-fill-color: #000;
  caret-color: #000;
}
.support-inbox-composer textarea { color: #1b3046; }

.support-chat-window ::selection { color: #000; background: #cfe2ff; }

.support-chat-composer textarea:focus,
.support-inbox-composer textarea:focus { border-color: #2478e7; outline: 3px solid #2478e722; }

#root main.support-chat-page .support-chat-composer textarea {
  min-height: 44px !important;
  margin: 0 !important;
  padding: 10px 12px !important;
  border: 1px solid #cbd7e4 !important;
  border-radius: 14px !important;
  color: #000 !important;
  -webkit-text-fill-color: #000 !important;
  caret-color: #000 !important;
  background: #fff !important;
  font: 13px/1.45 Inter, "Segoe UI", Arial, sans-serif !important;
}

#root main.admin-support-page .support-inbox-composer textarea { color: #1b3046 !important; }

.support-chat-send,
.support-inbox-send {
  min-height: 42px;
  padding: 0 16px;
  border: 0;
  border-radius: 12px;
  font: 700 13px Inter, "Segoe UI", Arial, sans-serif;
  cursor: pointer;
}

.support-chat-send { color: #000; background: #dcecff; }
.support-inbox-send { color: #fff; background: #1766df; }

.support-chat-send:hover:not(:disabled) { background: #c6defc; }
.support-inbox-send:hover:not(:disabled) { background: #0a55c7; }
.support-chat-send:disabled,
.support-inbox-send:disabled { opacity: .6; cursor: wait; }

#root main.support-chat-page .support-chat-send {
  width: auto !important;
  min-width: 0 !important;
  min-height: 42px !important;
  margin: 0 !important;
  padding: 0 16px !important;
  border: 1px solid #b7d2f6 !important;
  border-radius: 12px !important;
  color: #000 !important;
  background: #dcecff !important;
  font: 700 13px Inter, "Segoe UI", Arial, sans-serif !important;
}

#root main.admin-support-page .support-inbox-send {
  width: auto !important;
  min-width: 0 !important;
  min-height: 42px !important;
  margin: 0 !important;
  padding: 0 16px !important;
  border: 0 !important;
  border-radius: 12px !important;
  color: #fff !important;
  background: #1766df !important;
  font: 700 13px Inter, "Segoe UI", Arial, sans-serif !important;
}

#root main.support-chat-page {
  width: min(980px, calc(100% - 28px)) !important;
  max-width: 980px !important;
  margin: 24px auto !important;
  padding: clamp(18px, 4vw, 34px) !important;
}

#root main.support-chat-page > :not(#dinagatease-support-page-host):not(.support-chat-window) { display: none !important; }

#dinagatease-support-page-host { margin-bottom: 8px; }
#dinagatease-support-page-host h1 { margin: 0 0 5px; color: #132c47; font-size: clamp(26px, 4vw, 36px); font-weight: 750; }
#dinagatease-support-page-host p { margin: 0; color: #60748a; font-size: 14px; }

.support-chat-window.is-page {
  position: relative;
  inset: auto;
  width: min(890px, 100%);
  height: min(660px, calc(100dvh - 220px));
  min-height: 390px;
  max-height: none;
  margin: 20px auto 0;
  border-radius: 17px;
}

.support-chat-window.is-page .support-chat-header { min-height: 72px; }
.support-chat-window.is-page .support-chat-minimize { display: none; }

@media (max-width: 600px) {
  .support-widget { right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); }
  .support-widget-launcher { min-height: 50px; padding: 0 15px; }
  .support-chat-window { width: calc(100vw - 20px); height: calc(100dvh - 24px); max-height: none; min-height: 0; border-radius: 17px; }
  #root main.support-chat-page { width: calc(100% - 16px) !important; margin: 12px auto !important; padding: 16px !important; }
  .support-chat-window.is-page { width: 100%; height: min(660px, calc(100dvh - 190px)); min-height: 360px; margin-top: 14px; }
  .support-chat-composer { padding: 10px; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .support-chat-composer textarea { min-height: 42px; }
  .support-chat-send { padding-inline: 12px; }
}
