* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; height: 100dvh; display: grid; grid-template-rows: 55px minmax(0, 1fr) 62px; background: #d6d5cd url("assets/marketing-room.webp") center / cover no-repeat; font: 13px Inter, Geist, "Segoe UI", sans-serif; color: #252b2b; }
button, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, textarea:focus-visible { outline: 2px solid #398b25; outline-offset: 2px; }
.desktop-bar { display: flex; align-items: center; gap: 10px; padding: 10px 18px 0; color: #fff; }
.desktop-bar img { width: 42px; height: 42px; filter: drop-shadow(0 2px 5px #0005); }
.desktop-bar span { padding: 7px 12px; border-radius: 20px; background: #2229; backdrop-filter: blur(12px); }
.stage { min-height: 0; display: grid; place-items: center; overflow: hidden; padding: 10px 22px; }
#chat-window { width: min(1300px, 100%); height: min(725px, 100%); transform: translate(var(--x, 0px), var(--y, 0px)); --window-rail-width: 64px; --window-titlebar-height: 32px; --window-control-width: 32px; --window-control-height: 26px; --window-chrome-radius: 27px; --window-control-color: #535958; }
#chat-window.maximized { width: 100%; height: 100%; transform: none; }
#chat-window .invisible-window__glass-edge { border-radius: 27px; box-shadow: 0 16px 54px #191e253a; }
#chat-window .invisible-window__identity { justify-content: center; padding: 8px 0; }
.invisible-window__identity img { width: 38px; height: 38px; object-fit: contain; }
#chat-window .invisible-window__titlebar { z-index: 3; }
#chat-window .active-chat { display: grid; grid-template-columns: clamp(230px, 30vw, 420px) minmax(0, 1fr); overflow: hidden; border-radius: 27px 0 27px 27px; background: #fff; }
.agent-profile {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 0;
  display: flex;
  align-items: flex-end;
  padding: clamp(18px, 3vw, 38px);
  background: radial-gradient(ellipse at 56% 37%, #d6e5db 0%, #a5c0b3 40%, #3e655a 100%);
  border-right: 1px solid #dfe7e1;
}
.agent-portrait { position: absolute; inset: 0; z-index: -2; }
.agent-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  filter: drop-shadow(0 16px 21px #18383242);
}
.agent-profile::after {
  content: "";
  position: absolute;
  inset: 40% 0 0;
  z-index: -1;
  background: linear-gradient(transparent 12%, #102c28aa 63%, #122b26f5);
}
.agent-identity h2 { margin: 0; font-size: clamp(48px, 7vw, 92px); line-height: .94; letter-spacing: -.075em; font-weight: 680; color: #fff; }
.agent-identity p { margin: 10px 0 0; color: #e1eee8; font-size: 14px; }
.contact h1 { font-size: 13px; font-weight: 650; margin: 0; }
.contact p { color: #646f70; }
.thread { display: grid; grid-template-rows: 68px minmax(0, 1fr) auto; min-height: 0; }
.contact { display: flex; align-items: center; gap: 10px; padding: 0 22px; border-bottom: 1px solid #e2e5e5; }
.contact img, .message-avatar { width: 41px; height: 41px; flex: none; border-radius: 50%; object-fit: cover; object-position: center 18%; background: #f3f5f4; }
.contact p { margin-top: 4px; font-size: 11px; }
.transcript { min-height: 0; overflow: auto; padding: 16px 16px 8px; }
#chat-date { display: block; text-align: center; margin-bottom: 22px; color: #677171; font-size: 10px; }
[data-room="marketing"] {
  --agent-bubble-fill: #eee4f8;
  --agent-bubble-light: #fdfbff;
  --agent-bubble-edge: #e3d6ef;
}
.message {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 22px;
  --bubble-fill: var(--agent-bubble-fill, #f7f5fc);
  --bubble-edge: var(--agent-bubble-edge, #e5dff2);
}
.message-avatar { width: 34px; height: 34px; margin-top: 17px; box-shadow: 0 0 0 2px #fff, 0 0 0 3px #e6ebe7; }
.message-content {
  max-width: min(calc(100% - 48px), 560px);
  min-width: 0;
  display: grid;
  gap: 6px;
  justify-items: start;
}
.message-content strong { font-size: 11px; font-weight: 650; color: #4e455e; }
.message-content time { font-size: 10px; line-height: 1; color: #68736e; }
.message-content p {
  position: relative;
  isolation: isolate;
  margin: 0;
  padding: 11px 15px;
  border: 1px solid var(--bubble-edge);
  border-radius: 6px 17px 17px 17px;
  background: var(--bubble-fill);
  box-shadow: 0 2px 5px #2430290b;
  color: #28312e;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.message-content p::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 10px;
  left: -5px;
  width: 8px;
  height: 8px;
  background: var(--bubble-fill);
  border: solid var(--bubble-edge);
  border-width: 0 0 1px 1px;
  border-radius: 0 0 0 2px;
  transform: rotate(45deg);
}
.message.user {
  justify-content: flex-end;
  --bubble-fill: #e9f5ee;
  --bubble-edge: #cfe6d7;
}
.message.user .message-content { justify-items: end; }
.message.user strong { color: #315b45; }
.message.user p { border-radius: 17px 6px 17px 17px; }
.message.user p::before {
  left: auto;
  right: -5px;
  border-width: 1px 1px 0 0;
  border-radius: 0 2px 0 0;
}
.user-avatar {
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, #edf6ef, #cbdfd4);
  color: #4e7561;
}
.user-avatar::before, .user-avatar::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  background: currentColor;
}
.user-avatar::before { top: 7px; width: 9px; height: 9px; border-radius: 50%; }
.user-avatar::after { bottom: 5px; width: 17px; height: 10px; border-radius: 10px 10px 5px 5px; }
.composition { padding: 9px 12px 12px; }
#status { margin: 0 0 8px; color: #52605d; font-size: 12px; }
#status:empty { display: none; }
form { display: flex; flex-direction: column; padding: 11px 8px 8px; border: 1px solid #dbe0df; border-radius: 13px; }
form:focus-within { border-color: #84a17a; }
textarea { width: 100%; min-width: 0; height: 42px; resize: none; padding: 3px 7px; border: 0; color: inherit; background: transparent; outline: 0 !important; }
#send { align-self: flex-end; width: 37px; height: 37px; border: 0; border-radius: 50%; background: #388324; color: white; font-size: 19px; }
#send:disabled { background: #a0a5a3; cursor: default; }
.desktop-footer {position: relative; display: grid; place-items: center; padding-bottom: 6px; }
.dock { display: flex; padding: 4px 15px; border-radius: 24px; border: 1px solid #fff8; background: #f4f4f35e; backdrop-filter: blur(18px); box-shadow: 0 4px 17px #0002; }
.dock button { display: grid; place-items: center; width: 45px; height: 43px; padding: 0; border: 0; border-bottom: 2px solid transparent; border-radius: 13px; background: #ffffff80; }
.dock button[aria-expanded=true] { border-bottom-color: #3a95bc; }
.dock img { width: 33px; height: 33px; }
#clock { position: absolute; bottom: 14px; right: 19px; color: white; text-shadow: 0 1px 5px #000, 0 0 10px #000; white-space: pre-line; text-align: right; font-size: 12px; }
@media (max-width: 700px) {
  body { grid-template-rows: 46px minmax(0,1fr) 55px; }
  .desktop-bar { padding-top: 4px; }
  .desktop-bar img { width: 33px; height: 33px; }
  .stage { padding: 6px; }
  #chat-window { --window-rail-width: 42px; transform: none; }
  #chat-window .active-chat { display: flex; border-radius: 0 0 20px 20px; }
  .agent-profile { display: none; }
  .invisible-window__identity img { width: 27px; height: 27px; }
  .thread { flex: 1; grid-template-rows: 55px minmax(0, 1fr) auto; }
  .contact, .transcript { padding-inline: 12px; }
}

.transcript {
  background: radial-gradient(ellipse at 0 100%, #f6f2fd 0, transparent 44%),
              radial-gradient(ellipse at 100% 100%, #edf7f2 0, transparent 42%), #fcfdfd;
}
#chat-date { display: flex; align-items: center; justify-content: center; gap: 12px; }
#chat-date::before, #chat-date::after {
  content: "";
  width: 42px;
  height: 1px;
  background: #e1e6e3;
}
.message { --bubble-light: var(--agent-bubble-light, #fcfaff); --message-entry-x: -5px; }
.message.user { --bubble-light: #f4fbf6; --message-entry-x: 5px; }
.message-content p {
  background: linear-gradient(155deg, var(--bubble-light) 8%, var(--bubble-fill) 100%);
  box-shadow: inset 0 1px #fff, 0 3px 10px #26342c0b;
}
.message-content p::before { background: var(--bubble-light); }
.composition { background: #fff; border-top: 1px solid #e9eeeb; }
.composition form:focus-within { box-shadow: 0 0 0 3px #e0f0e5; }
#send:not(:disabled):hover { background: #28671b; }
.is-replying #status {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 5px 10px;
  border-radius: 999px;
  color: #594781;
  background: #f3eef9;
}
.is-replying #status::before {
  content: "";
  width: 4px;
  height: 4px;
  margin-inline: 5px;
  border-radius: 50%;
  background: #795da9;
  box-shadow: -6px 0 #ad98cf, 6px 0 #ad98cf;
}
.is-replying .contact img { box-shadow: 0 0 0 2px #fff, 0 0 0 4px #d9c9f0; }
@media (prefers-reduced-motion: no-preference) {
  .message { animation: message-appear 200ms ease-out both; }
  .is-replying #status::before { animation: reply-dots .8s ease-in-out infinite alternate; }
}
@keyframes message-appear {
  from { opacity: 0; transform: translate(var(--message-entry-x), 4px); }
  to { opacity: 1; transform: translate(0, 0); }
}
@keyframes reply-dots {
  from { opacity: .52; transform: translateY(1px); }
  to { opacity: 1; transform: translateY(-1px); }
}
