/* Load after light.css. Presentation is isolated from the conversation API. */
.chat-launcher {
  position: fixed;
  z-index: 45;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #f4f9ef;
  background: #253a25;
  border: 1px solid #41563a;
  box-shadow: 0 7px 24px #1b301c24;
  cursor: pointer;
  transition: background .2s ease, box-shadow .2s ease, transform .2s ease;
}
.chat-launcher { right: max(26px, env(safe-area-inset-right)); bottom: max(24px, env(safe-area-inset-bottom)); gap: 10px; min-height: 54px; padding: 12px 18px; border-radius: 12px; }
.chat-launcher > svg { width: 24px; height: 24px; flex: none; color: #e0f8b8; }
.chat-launcher-label { font: 500 .9375rem/1.4 var(--sans); white-space: nowrap; }
.chat-side-tab[hidden], .contact-chat[hidden] { display: none !important; }
.chat-launcher:hover { background: #354d30; box-shadow: 0 8px 28px #1b301c36; transform: translateY(-2px); }
.chat-launcher:focus-visible { outline: 3px solid #739b3d; outline-offset: 4px; }
.chat-is-open { overflow: hidden; }
.chat-is-open .chat-launcher { visibility: hidden; }

#chat-dialog {
  position: fixed;
  inset: auto max(24px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) auto;
  width: 430px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid #cad7c1;
  border-radius: 18px;
  color: #233021;
  background: #fff;
  box-shadow: 0 24px 80px #22331c30, 0 4px 16px #22331c12;
  text-align: left;
}
#chat-dialog[open] { display: flex; flex-direction: column; animation: chat-enter .18s ease-out; }
#chat-dialog::backdrop { background: #17221038; backdrop-filter: blur(2px); }
#chat-dialog [hidden] { display: none !important; }
#chat-dialog .chat-panel-header { position: relative; flex: none; padding: 23px 24px 20px; background: #f3f7ed; border-bottom: 1px solid #dce5d4; }
.chat-panel-brand { display: flex; gap: 11px; align-items: center; padding-right: 35px; margin-bottom: 24px; }
.chat-panel-mark { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border: 1px solid #bdd298; border-radius: 11px; background: #e5f4c7; color: #405f25; }
.chat-panel-mark svg { width: 23px; height: 23px; }
.chat-panel-identity { min-width: 0; }
.chat-panel-name { font-size: 1.0625rem; font-weight: 650; letter-spacing: -.035em; line-height: 1.4; margin: 0; }
.chat-panel-specialty { margin: 3px 0 0; color: #57684c; font-size: .75rem; line-height: 1.4; }
#chat-dialog .dialog-close { display: grid; place-items: center; top: 18px; right: 16px; min-width: 44px; min-height: 44px; width: 44px; height: 44px; padding: 11px; color: #526349; border: 1px solid transparent; border-radius: 50%; }
#chat-dialog .dialog-close svg { width: 21px; height: 21px; }
#chat-dialog .dialog-close:hover { color: #20301b; background: #e6edde; border-color: #d1ddc6; }
.chat-panel-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
#chat-dialog #chat-title { font: 550 1.625rem/1.25 var(--sans); letter-spacing: -.045em; margin: 0; }
.chat-privacy-label { color: #56654d; font-size: .75rem; line-height: 1.5; }
#chat-dialog #chat-dialog-copy { color: #53634a; font-size: .875rem; line-height: 1.6; margin: 9px 0 0; }
.chat-panel-body { padding: 23px 24px 20px; overflow-y: auto; overscroll-behavior: contain; min-height: 0; scrollbar-width: thin; scrollbar-color: #bdcbb2 #f9fbf6; }
.chat-welcome-icon { display: grid; place-items: center; width: 46px; height: 46px; border: 1px solid #d6e2cb; border-radius: 13px; background: #f4f8ed; color: #62813e; margin-bottom: 16px; }
.chat-welcome-icon svg { width: 25px; height: 25px; }
.chat-welcome-title { margin: 0 0 9px; font-size: 1.125rem; line-height: 1.45; font-weight: 550; letter-spacing: -.02em; }
.chat-welcome-copy { color: #5b6953; font-size: .875rem; line-height: 1.7; margin: 0; }
.chat-platforms { display: flex; flex-wrap: wrap; gap: 6px; margin: 17px 0 21px; }
.chat-platforms span { color: #59684f; background: #f5f7f1; border: 1px solid #e0e7d9; border-radius: 5px; padding: 4px 7px; font-size: .6875rem; line-height: 1.5; }
#chat-dialog #chat-setup-notice { margin: 0 0 17px; padding: 13px 14px; color: #66592f; border: 1px solid #e5dcbf; border-radius: 9px; background: #fffcf3; font-size: .8125rem; line-height: 1.7; }
#chat-dialog .chat-prepare-brief { width: 100%; min-height: 48px; padding: 12px 15px; border-radius: 8px; border-color: #b4c991; background: #e0f1bd; color: #2f481d; font-size: .875rem; font-weight: 500; }
#chat-dialog .chat-prepare-brief:hover { background: #d5eaa9; }
.chat-loading { padding: 35px 0; text-align: center; color: #66735e; font-size: .875rem; }
.chat-panel-footer { flex: none; padding: 13px 20px; border-top: 1px solid #e3e9dd; background: #fbfcf9; text-align: center; color: #6a765f; font-size: .6875rem; letter-spacing: .02em; }
#chat-dialog #chat-start-form { margin: 0; }
#chat-dialog .form-row { gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
#chat-dialog label { display: block; color: #495e3c; font-size: .8125rem; line-height: 1.5; margin-bottom: 14px; }
#chat-dialog input, #chat-dialog textarea { width: 100%; min-width: 0; border: 1px solid #bdcdb0; border-radius: 7px; background: #fff; color: #293724; padding: 11px 12px; font-family: var(--sans); font-size: 1rem; line-height: 1.5; margin: 6px 0 0; }
#chat-dialog textarea { min-height: 110px; resize: vertical; }
#chat-dialog input::placeholder, #chat-dialog textarea::placeholder { color: #6b7862; opacity: 1; }
#chat-dialog .optional-label { font-size: .75rem; color: #6b7862; }
#chat-dialog .chat-privacy-note { font-size: .75rem !important; line-height: 1.65 !important; color: #66745b !important; margin: 12px 0 !important; }
#chat-dialog .button:not(.chat-prepare-brief) { border-radius: 8px; font-size: .875rem; min-height: 48px; }
#chat-dialog .button:disabled { opacity: .6; cursor: wait; }
#chat-dialog #chat-status { color: #496238; font-size: .8125rem; line-height: 1.6; margin: 12px 0 0; overflow-wrap: anywhere; }
#chat-dialog #chat-status:empty { display: none; }
#chat-dialog #visitor-connection { margin: 0 0 13px; color: #586b4a; font: .75rem/1.6 var(--sans); padding-bottom: 11px; border-bottom: 1px solid #e4eadd; }
#chat-dialog .visitor-messages { height: 270px; max-height: 35dvh; padding: 1px 2px 18px; gap: 16px; }
#chat-dialog .visitor-message { max-width: 92%; }
#chat-dialog .visitor-message > p { color: #33482b; background: #f1f5eb; border: 1px solid #dce6d1; font-size: .875rem; line-height: 1.65; padding: 11px 13px; }
#chat-dialog .visitor-message.visitor > p { color: #2b421b; background: #e4f2ca; border-color: #cadcaa; }
#chat-dialog .visitor-message > small { color: #6a7b5b; font-size: .6875rem; line-height: 1.5; margin: 5px 2px 0; }
#chat-dialog #visitor-reply-form { border-top: 1px solid #dce5d4; padding-top: 14px; gap: 9px; }
#chat-dialog #visitor-reply { min-height: 54px; max-height: 130px; margin: 0; }
#chat-dialog #visitor-reply-form .button { padding: 12px 16px; flex: none; }
#chat-dialog :focus-visible { outline: 3px solid #7d9e52; outline-offset: 3px; }

/* Optional contact details stay out of the primary project-writing flow. */
#brief-form details, #chat-start-form details { margin: 6px 0 18px; border: 1px solid #d7e1cf; border-radius: 8px; background: #f8faf5; }
#brief-form details > summary, #chat-start-form details > summary { min-height: 48px; padding: 13px 14px; color: #415237; font: 500 .875rem/1.5 var(--sans); cursor: pointer; }
#brief-form details > summary::marker, #chat-start-form details > summary::marker { color: #597440; }
#brief-form details > .form-row, #chat-start-form details > .form-row { padding: 4px 14px 0; }
#brief-form details label, #chat-start-form details label { margin-bottom: 14px; }
#brief-form [data-open-privacy], #chat-dialog [data-open-privacy] { display: inline-flex; align-items: center; min-height: 44px; margin: 0; padding: 6px 2px; border: 0; background: transparent; color: #3c592c; font: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
#brief-form [data-open-privacy]:hover, #chat-dialog [data-open-privacy]:hover { color: #243c16; }
#brief-form :focus-visible, #chat-dialog :focus-visible { outline: 3px solid #7d9e52; outline-offset: 3px; }

@keyframes chat-enter { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 600px) {
  .chat-launcher { right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); min-height: 50px; padding: 12px 15px; }
  .chat-launcher-label { font-size: .875rem; }
  #chat-dialog { inset: auto 10px max(10px, env(safe-area-inset-bottom)) auto; width: calc(100vw - 20px); max-width: 430px; max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); border-radius: 16px; }
  #chat-dialog .chat-panel-header { padding: 20px 20px 17px; }
  .chat-panel-brand { margin-bottom: 19px; }
  .chat-panel-body { padding: 20px; }
  #chat-dialog .chat-panel-footer { padding: 11px 16px; }
  #chat-dialog .dialog-close { top: 14px; right: 11px; }
  #chat-dialog .visitor-messages { height: 250px; max-height: 35dvh; }
  #chat-dialog .form-row, #brief-form .form-row { grid-template-columns: 1fr; gap: 0; }
  #chat-dialog input, #chat-dialog textarea, #brief-form input, #brief-form select, #brief-form textarea { font-size: 16px; }
}
@media (max-width: 380px) {
  #chat-dialog .chat-panel-header { padding: 18px 17px 16px; }
  .chat-panel-body { padding: 18px 17px; }
  .chat-panel-specialty { font-size: .6875rem; }
}
@media (max-height: 570px) {
  #chat-dialog .chat-panel-header { padding-top: 15px; padding-bottom: 13px; }
  .chat-panel-brand { margin-bottom: 11px; }
  .chat-panel-specialty, .chat-panel-footer { display: none; }
  #chat-dialog .chat-panel-body { padding-top: 16px; padding-bottom: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .chat-launcher { transition: none; }
  #chat-dialog[open] { animation: none; }
}
@media (forced-colors: active) {
  .chat-launcher, .chat-panel-mark { border: 1px solid ButtonText; }
}
