:root {
  --trex-spruce: #02463A;
  --trex-spruce-tint: #386C66;
  --trex-leaf: #85BE00;
  --trex-new-leaf: #D4ED98;
  --trex-limestone: #F7F5F2;
  --trex-limestone-shade: #EAE7E4;
  --trex-smoky-quartz: #69625D;
  --trex-warm-slate: #3D3936;
  --trex-white: #FFFFFF;
  --trex-font-sans: "Proxima Nova", "Segoe UI", Arial, sans-serif;
  --trex-font-serif: "Utopia Std", "Source Serif Pro", Georgia, serif;
}

.trex-chat-launcher,
.trex-chat-panel,
.trex-chat-panel *,
.trex-contact-modal,
.trex-contact-modal * {
  box-sizing: border-box;
}

.trex-chat-launcher {
  position: fixed;
  right: 24px;
  bottom: 24px;
  min-width: 72px;
  height: 60px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: var(--trex-spruce);
  color: var(--trex-white);
  cursor: pointer;
  box-shadow: 0 18px 48px rgba(2, 70, 58, 0.28);
  z-index: 999999;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 18px;
  font-family: var(--trex-font-sans);
  transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.trex-chat-launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 22px 58px rgba(2, 70, 58, 0.36);
}

.trex-chat-launcher.is-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
}

.trex-launcher-bubble {
  position: relative;
  width: 25px;
  height: 19px;
  border-radius: 999px;
  background: var(--trex-white);
}

.trex-launcher-bubble::after {
  content: "";
  position: absolute;
  right: 4px;
  bottom: -4px;
  width: 8px;
  height: 8px;
  background: var(--trex-white);
  clip-path: polygon(0 0, 100% 0, 100% 100%);
}

.trex-launcher-text {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.trex-chat-panel {
  position: fixed;
  right: 24px;
  bottom: 96px;
  width: min(410px, calc(100vw - 28px));
  height: min(640px, calc(100vh - 126px));
  background: var(--trex-white);
  border: 1px solid var(--trex-limestone-shade);
  border-radius: 24px;
  box-shadow: 0 22px 70px rgba(2, 70, 58, 0.22);
  overflow: hidden;
  display: none;
  flex-direction: column;
  z-index: 999999;
  font-family: var(--trex-font-sans);
  color: var(--trex-warm-slate);
}

.trex-chat-panel.is-open {
  display: flex;
}

.trex-chat-header {
  background:
    radial-gradient(circle at top right, rgba(133, 190, 0, 0.2), transparent 36%),
    linear-gradient(135deg, var(--trex-spruce), var(--trex-spruce-tint));
  color: var(--trex-white);
  padding: 17px 18px 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}

.trex-chat-kicker,
.trex-contact-kicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 7px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.trex-chat-kicker::before,
.trex-contact-kicker::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--trex-leaf);
  box-shadow: 0 0 0 4px rgba(133, 190, 0, 0.18);
}

.trex-chat-header strong {
  display: block;
  font-family: var(--trex-font-serif);
  font-size: 24px;
  line-height: 1.05;
  font-weight: 700;
  letter-spacing: -0.035em;
}

.trex-chat-header span {
  display: block;
  max-width: 310px;
  font-size: 12px;
  line-height: 1.35;
  opacity: 0.88;
  margin-top: 6px;
}

.trex-chat-close,
.trex-contact-close {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  color: var(--trex-white);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.trex-chat-close:hover,
.trex-contact-close:hover {
  background: rgba(255,255,255,.16);
}

.trex-chat-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  background:
    linear-gradient(180deg, rgba(234, 231, 228, .68), rgba(247, 245, 242, .96));
  scrollbar-width: thin;
  scrollbar-color: var(--trex-spruce-tint) var(--trex-limestone-shade);
}

.trex-msg {
  max-width: 88%;
  padding: 12px 14px;
  border-radius: 18px;
  margin: 0 0 12px;
  line-height: 1.45;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.trex-msg a {
  color: var(--trex-spruce);
  font-weight: 800;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.trex-msg.bot {
  background: var(--trex-white);
  color: var(--trex-warm-slate);
  border: 1px solid var(--trex-limestone-shade);
  border-top-left-radius: 6px;
  box-shadow: 0 6px 18px rgba(61,57,54,.06);
}

.trex-msg.user {
  margin-left: auto;
  background: var(--trex-spruce);
  color: var(--trex-white);
  border-top-right-radius: 6px;
}

.trex-msg.is-loading {
  color: var(--trex-smoky-quartz);
  font-style: italic;
}

.trex-chat-form {
  display: flex;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid var(--trex-limestone-shade);
  background: var(--trex-white);
}

.trex-chat-input {
  flex: 1;
  min-width: 0;
  border: 1px solid rgba(2,70,58,.22);
  border-radius: 999px;
  padding: 12px 14px;
  font-size: 14px;
  outline: none;
  color: var(--trex-warm-slate);
  background: var(--trex-limestone);
  font-family: var(--trex-font-sans);
}

.trex-chat-input:focus {
  border-color: var(--trex-spruce);
  box-shadow: 0 0 0 3px rgba(133,190,0,.18);
  background: var(--trex-white);
}

.trex-chat-send,
.trex-contact-open-btn,
.trex-btn {
  border: none;
  background: var(--trex-leaf);
  color: var(--trex-spruce);
  border-radius: 999px;
  cursor: pointer;
  font-weight: 900;
  font-family: var(--trex-font-sans);
  letter-spacing: 0.01em;
}

.trex-chat-send {
  padding: 0 18px;
}

.trex-chat-send:hover,
.trex-contact-open-btn:hover,
.trex-btn:hover {
  filter: brightness(.96);
}

.trex-chat-send:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.trex-chat-sources {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--trex-limestone-shade);
  font-size: 11px;
  color: var(--trex-smoky-quartz);
}

.trex-contact-cta {
  margin-top: 12px;
  padding: 12px;
  border-radius: 16px;
  background: var(--trex-limestone);
  border: 1px solid var(--trex-limestone-shade);
}

.trex-contact-cta strong {
  display: block;
  color: var(--trex-spruce);
  font-size: 13px;
  margin-bottom: 3px;
}

.trex-contact-cta span {
  display: block;
  color: var(--trex-smoky-quartz);
  font-size: 12px;
  line-height: 1.35;
}

.trex-contact-open-btn {
  margin-top: 10px;
  padding: 9px 13px;
  font-size: 12px;
}

/* Contact modal */
.trex-contact-modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 1000002;
  font-family: var(--trex-font-sans);
}

.trex-contact-modal.is-open {
  display: block;
}

.trex-contact-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 70, 58, 0.52);
  backdrop-filter: blur(4px);
}

.trex-contact-dialog {
  position: relative;
  width: min(820px, calc(100vw - 28px));
  max-height: min(820px, calc(100vh - 32px));
  margin: 16px auto;
  border-radius: 24px;
  overflow: auto;
  background: var(--trex-white);
  border: 1px solid rgba(255,255,255,.35);
  box-shadow: 0 24px 90px rgba(0,0,0,.28);
}

.trex-contact-modal-header {
  position: sticky;
  top: 0;
  z-index: 2;
  background:
    radial-gradient(circle at top right, rgba(133, 190, 0, 0.22), transparent 34%),
    linear-gradient(135deg, var(--trex-spruce), var(--trex-spruce-tint));
  color: var(--trex-white);
  padding: 18px 20px 16px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.trex-contact-modal-header strong {
  display: block;
  font-family: var(--trex-font-serif);
  font-size: 28px;
  line-height: 1.05;
  letter-spacing: -0.035em;
}

.trex-contact-modal-header span {
  display: block;
  opacity: .88;
  font-size: 13px;
  line-height: 1.4;
  margin-top: 6px;
}

.trex-contact-wrapper {
  padding: 18px 16px 22px;
  background: var(--trex-limestone);
}

.trex-contact-grid {
  max-width: 720px;
  margin: 0 auto;
}

.trex-top-form {
  background: linear-gradient(135deg, #e6f5ee 0%, #ffffff 45%, #f5fbf8 100%);
  border-radius: 22px;
  padding: 24px 20px 20px;
  border: 1px solid #d3e6dd;
  box-shadow: 0 16px 40px rgba(0,0,0,.07);
}

.trex-step-header {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  margin-bottom: 16px;
  justify-content: center;
  border-bottom: 1px solid #d6e3dd;
  padding-bottom: 2px;
}

.trex-step-pill {
  position: relative;
  padding: 0 0 10px;
  border-radius: 0;
  font-size: 13px;
  font-weight: 700;
  background: none;
  color: #8a9b94;
  border: 0;
  box-shadow: none;
  cursor: pointer;
}

.trex-step-pill::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 2px;
  border-radius: 999px;
  background: transparent;
  transition: background .18s ease, transform .18s ease;
  transform-origin: center;
  transform: scaleX(0);
}

.trex-step-pill-active {
  color: var(--trex-spruce);
}

.trex-step-pill-active::after {
  background: linear-gradient(90deg, var(--trex-spruce), var(--trex-leaf));
  transform: scaleX(1);
}

.trex-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}

.trex-field {
  flex: 1 1 190px;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.trex-field label {
  font-size: 13px;
  font-weight: 700;
  color: #2a4038;
  margin-bottom: 4px;
}

.trex-field label span.req {
  color: #c23434;
  margin-left: 2px;
}

.trex-field input,
.trex-field select,
.trex-field textarea {
  font-size: 14px;
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid #cfdcd6;
  outline: none;
  width: 100%;
  box-sizing: border-box;
  transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease;
  background-color: #ffffff;
}

.trex-field textarea {
  min-height: 110px;
  resize: vertical;
}

.trex-field input:focus,
.trex-field select:focus,
.trex-field textarea:focus {
  border-color: var(--trex-spruce);
  box-shadow: 0 0 0 1px rgba(2,70,58,.15);
  background-color: #f7fbf9;
}

.trex-actions {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-start;
}

.trex-actions-center {
  justify-content: center;
}

.trex-btn {
  padding: 10px 24px;
  color: var(--trex-white);
  background: linear-gradient(135deg, var(--trex-spruce), var(--trex-spruce-tint));
  box-shadow: 0 10px 24px rgba(2,70,58,.30);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.trex-btn[data-loading="1"] {
  opacity: .7;
  box-shadow: none;
  transform: none;
  cursor: wait;
}

.trex-btn[data-loading="1"]::after {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.6);
  border-top-color: #ffffff;
  animation: trex-spin .8s linear infinite;
}

@keyframes trex-spin {
  to { transform: rotate(360deg); }
}

.trex-submit-status {
  font-size: 12px;
  color: #60736b;
  margin-top: 6px;
  text-align: center;
  min-height: 1em;
}

.trex-iframe-shell {
  border-radius: 16px;
  border: 1px dashed #cfdcd6;
  background: #f6faf8;
  overflow: hidden;
  height: 1px;
  padding: 0;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity .25s ease, transform .25s ease, height .25s ease, padding .25s ease;
  margin-top: 0;
}

#tc-odoo-form {
  display: block;
  width: 100%;
  border: none;
  border-radius: 12px;
  min-height: 550px;
  background: #ffffff;
}

.trex-step {
  display: none;
}

.trex-step-active {
  display: block;
}

.trex-loading-shell {
  display: none;
  margin-top: 18px;
  border-radius: 18px;
  border: 1px solid #d3e6dd;
  background: #ffffff;
  box-shadow: 0 14px 36px rgba(0,0,0,.07);
  padding: 18px 16px;
  text-align: center;
}

.trex-loading-title {
  font-weight: 800;
  color: #10271f;
  font-size: 16px;
  margin: 0 0 6px;
}

.trex-loading-sub {
  color: #60736b;
  font-size: 13px;
  margin: 0 0 12px;
}

.trex-loading-spinner {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 3px solid rgba(7,98,52,.20);
  border-top-color: var(--trex-spruce);
  animation: trex-spin 0.8s linear infinite;
  margin: 0 auto;
}

.trex-contact-wrapper.trex-form-sending #tc-top-form,
.trex-contact-wrapper.trex-form-sent #tc-top-form {
  display: none !important;
}

.trex-contact-wrapper.trex-form-sending .trex-loading-shell {
  display: block;
}

.trex-contact-wrapper.trex-form-sent .trex-loading-shell {
  display: none;
}

.trex-contact-wrapper.trex-form-sent .trex-iframe-shell {
  height: auto;
  padding: 8px;
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
  margin-top: 20px;
}

.trex-top-form .sub {
  margin: 0 0 14px;
  color: #60736b;
  font-size: 13px;
  text-align: center;
}

@media (max-width: 560px) {
  .trex-chat-panel {
    right: 10px;
    bottom: 86px;
    width: calc(100vw - 20px);
    height: min(650px, calc(100vh - 104px));
    border-radius: 20px;
  }

  .trex-chat-launcher {
    right: 16px;
    bottom: 16px;
  }

  .trex-chat-header strong {
    font-size: 22px;
  }

  .trex-contact-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    margin: 8px auto;
    border-radius: 20px;
  }

  .trex-contact-wrapper {
    padding: 14px 10px 18px;
  }

  .trex-top-form {
    padding: 20px 14px 16px;
    border-radius: 18px;
  }

  .trex-row {
    gap: 10px;
  }

  .trex-step-header {
    flex-direction: column;
    align-items: center;
    gap: 6px;
  }

  .trex-btn {
    width: 100%;
    justify-content: center;
  }

  .trex-actions,
  .trex-actions-center {
    justify-content: center;
  }
}
