.am-chat {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1000;
  font-family: Manrope, system-ui, sans-serif;
  color: #2b2522;
}
.am-chat-launcher {
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 18px;
  background: #6a4d3f;
  color: #fff;
  box-shadow: 0 18px 45px rgba(74, 53, 43, .22);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform .18s ease, background .18s ease;
}
.am-chat-launcher:hover { transform: translateY(-2px); background: #563d32; }
.am-chat-dot {
  position: absolute;
  right: 2px;
  top: 2px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #f25e5e;
  border: 3px solid #f7f1e8;
}
.am-chat-panel {
  position: absolute;
  right: 0;
  bottom: 72px;
  width: min(360px, calc(100vw - 32px));
  height: min(560px, calc(100vh - 120px));
  border-radius: 24px;
  overflow: hidden;
  background: rgba(255, 252, 247, .96);
  border: 1px solid rgba(111, 85, 70, .14);
  box-shadow: 0 28px 80px rgba(74, 53, 43, .22);
  backdrop-filter: blur(16px);
}
.am-chat-header {
  height: 64px;
  padding: 14px 18px;
  background: rgba(255,255,255,.72);
  border-bottom: 1px solid rgba(111, 85, 70, .10);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.am-chat-header strong { display: block; font-size: 15px; }
.am-chat-header span { display: block; margin-top: 2px; color: #8a7c72; font-size: 11px; }
.am-chat-header button {
  border: 0;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: #f1e8de;
  color: #6a4d3f;
  font-size: 22px;
  cursor: pointer;
}
.am-chat-body { height: calc(100% - 64px); }
.am-chat-start {
  height: 100%;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.am-chat-intro { margin: 0 0 6px; color: #6f625a; line-height: 1.55; font-size: 14px; }
.am-chat-start label { display: grid; gap: 7px; font-weight: 700; font-size: 12px; color: #5b4338; }
.am-chat-start input {
  min-height: 46px;
  border: 1px solid rgba(111, 85, 70, .16);
  border-radius: 16px;
  background: #fffaf4;
  padding: 0 14px;
  outline: 0;
  font: inherit;
}
.am-chat-policy { margin: 4px 0 0; font-size: 11px; line-height: 1.45; color: #8a7c72; }
.am-chat-policy a { color: #6a4d3f; }
.am-chat-primary {
  margin-top: auto;
  min-height: 48px;
  border: 0;
  border-radius: 999px;
  background: #6a4d3f;
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}
.am-chat-messenger { height: 100%; display: grid; grid-template-rows: 1fr auto auto; }
.am-chat-messages {
  padding: 18px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.am-chat-message {
  max-width: 84%;
  padding: 10px 12px 8px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(74, 53, 43, .06);
  font-size: 13px;
  line-height: 1.45;
}
.am-chat-message.is-client { align-self: flex-end; background: #6a4d3f; color: #fff; border-bottom-right-radius: 6px; }
.am-chat-message.is-manager { align-self: flex-start; background: #fff; border-bottom-left-radius: 6px; }
.am-chat-message.is-system { align-self: center; text-align: center; max-width: 92%; background: transparent; box-shadow: none; color: #8a7c72; font-size: 12px; }
.am-chat-message-name { display: block; font-weight: 800; font-size: 11px; opacity: .76; margin-bottom: 3px; }
.am-chat-message p { margin: 0; white-space: pre-wrap; word-break: break-word; }
.am-chat-message time { display: block; margin-top: 4px; font-size: 10px; opacity: .64; text-align: right; }
.am-chat-attachment { display: inline-block; margin-top: 6px; color: inherit; font-weight: 800; text-decoration: underline; }
.am-chat-form {
  padding: 10px;
  border-top: 1px solid rgba(111, 85, 70, .10);
  display: grid;
  grid-template-columns: 38px 1fr 38px;
  gap: 8px;
  align-items: end;
  background: rgba(255,255,255,.66);
}
.am-chat-form textarea {
  max-height: 110px;
  min-height: 40px;
  resize: none;
  border: 0;
  border-radius: 14px;
  padding: 10px 12px;
  background: #f6efe6;
  outline: 0;
  font: inherit;
}
.am-chat-form button,
.am-chat-file span {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 999px;
  background: #6a4d3f;
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 900;
  cursor: pointer;
}
.am-chat-file input { display: none; }
.am-chat-file span { background: #efe4d9; color: #6a4d3f; }
.am-chat-files {
  padding: 0 12px 10px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  background: rgba(255,255,255,.66);
}
.am-chat-files span {
  padding: 5px 8px;
  border-radius: 999px;
  background: #efe4d9;
  color: #6a4d3f;
  font-size: 11px;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 560px) {
  .am-chat { right: 14px; bottom: 14px; }
  .am-chat-panel { right: -2px; bottom: 66px; width: calc(100vw - 24px); height: min(620px, calc(100vh - 92px)); }
}

/* Fix: force hidden chat blocks to really disappear */
.am-chat [hidden] {
  display: none !important;
}
