:root {
  --salon-dark: #17181c;
  --salon-dark-soft: #23252b;
  --salon-gold: #d5b178;
  --salon-gold-strong: #c49957;
  --salon-chip: #2c2f37;
  --salon-cream: #f4f1eb;
  --line: #ebe4d8;
  --text: #1e2127;
  --muted: #7f8692;
  --surface: #ffffff;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(1100px 500px at 0% -10%, #f5efe5 0%, rgba(245, 239, 229, 0) 70%),
    radial-gradient(800px 500px at 100% 120%, #ece3d5 0%, rgba(236, 227, 213, 0) 65%),
    linear-gradient(180deg, #f8f6f2 0%, #f1ebe2 100%);
}

button,
textarea {
  font: inherit;
}

.chat-screen {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 18px;
}

.chat-widget {
  width: min(100%, 450px);
  height: min(100dvh - 26px, 780px);
  border-radius: 24px;
  overflow: hidden;
  position: relative;
  background: linear-gradient(180deg, #ffffff 0%, #fdfaf5 100%);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow:
    0 26px 70px rgba(16, 18, 23, 0.28),
    0 8px 20px rgba(16, 18, 23, 0.12);
  backdrop-filter: blur(3px);
  display: grid;
  grid-template-rows: auto 1fr auto auto;
}

.widget-header {
  background:
    radial-gradient(circle at 85% -30%, rgba(213, 177, 120, 0.28), transparent 45%),
    linear-gradient(180deg, var(--salon-dark) 0%, #1d1f25 100%);
  color: #fff;
  padding: 14px 0 10px 16px;
  display: flex;
  justify-content: space-between;
  align-items: stretch;
}

.widget-brand {
  display: flex;
  gap: 10px;
  align-items: center;
}

.brand-text {
  display: block;
}

.brand-logo {
  display: block;
  width: clamp(155px, 42vw, 235px);
  max-width: 100%;
  height: auto;
}

.brand-status {
  margin: 2px 0 0;
  font-size: 12px;
  color: #c1c6d0;
  display: flex;
  align-items: center;
  gap: 7px;
}

.dot-online {
  width: 8px;
  height: 8px;
  background: #1ece73;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 0 4px rgba(30, 206, 115, 0.18);
}

.widget-close {
  border: none;
  border-left: 1px solid rgba(255, 255, 255, 0.18);
  background: transparent;
  color: #f3f4f6;
  width: 64px;
  min-width: 64px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.widget-close:hover {
  background: rgba(255, 255, 255, 0.06);
}

.widget-close:active {
  background: rgba(255, 255, 255, 0.1);
}

.widget-close svg {
  display: block;
}

.messages-stack {
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-dev-notice {
  flex-shrink: 0;
  margin: 12px 12px 0;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid #e8dcc8;
  background: linear-gradient(180deg, #fff9f0 0%, #fdf6ec 100%);
  box-shadow: 0 2px 10px rgba(105, 84, 58, 0.08);
  color: #4a3f32;
  font-size: 13px;
  line-height: 1.45;
}

.chat-dev-notice-text {
  margin: 0 0 10px;
}

.chat-dev-notice-phones {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.chat-dev-notice-phones a {
  color: #7a5c3d;
  text-decoration: none;
  border-bottom: 1px solid rgba(122, 92, 61, 0.35);
}

.chat-dev-notice-phones a:hover {
  color: #5c452e;
  border-bottom-color: rgba(92, 69, 46, 0.55);
}

.messages {
  background: transparent;
  padding: 14px 12px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
}

.session-banner {
  margin: 0 12px;
  border: 1px solid #ead9c1;
  border-radius: 12px;
  padding: 8px 10px;
  background: #fff8ee;
  color: #69543a;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.session-banner-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.session-banner button {
  border: 1px solid #d8b88b;
  background: #fff;
  color: #6e5739;
  border-radius: 8px;
  padding: 4px 9px;
  cursor: pointer;
  font-size: 12px;
}

.hidden-banner {
  display: none;
}

.messages::-webkit-scrollbar {
  width: 8px;
}

.messages::-webkit-scrollbar-thumb {
  background: #d9cebd;
  border-radius: 999px;
}

.message {
  max-width: 86%;
  border: 1px solid #e8e1d3;
  border-radius: 16px;
  padding: 12px;
  background: var(--surface);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  animation: msg-enter 0.22s ease;
}

.message.own {
  margin-left: auto;
  border-color: #dcc4a3;
  background: linear-gradient(180deg, #fff7ef 0%, #f8efe4 100%);
}

.message .meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 5px;
}

.message .body {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.5;
}

.message .image {
  max-width: 100%;
  max-height: 260px;
  border-radius: 10px;
  display: block;
  margin-bottom: 8px;
  border: 1px solid #e0d8cd;
}

.hidden-image {
  display: none !important;
}

.composer {
  border: 1px solid var(--line);
  background: #fff;
  margin: 8px 12px 5px;
  border-radius: 16px;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 6px;
  padding: 7px 9px;
  box-shadow: 0 6px 16px rgba(26, 27, 32, 0.07);
}

.composer.is-disabled {
  opacity: 0.65;
}

.composer textarea {
  border: none;
  resize: none;
  outline: none;
  min-height: 30px;
  max-height: 120px;
  line-height: 1.42;
  color: #1f232b;
  background: transparent;
}

.composer textarea::placeholder {
  color: #a3a9b3;
}

.hidden-file {
  display: none;
}

.composer-icon,
.send-btn {
  border: none;
  background: transparent;
  color: #acb1ba;
  font-size: 18px;
  cursor: pointer;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.composer-icon:hover {
  background: #f2f3f6;
  color: #8a919f;
}

.send-btn {
  color: #ffffff;
  background: #a78165;
  box-shadow: 0 5px 12px rgba(167, 129, 101, 0.34);
}

.send-btn:hover {
  filter: brightness(1.04);
}

.send-btn:active {
  transform: translateY(1px);
}

.widget-footnote {
  text-align: center;
  color: #baab98;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 7px 10px 12px;
}

:focus-visible {
  outline: 2px solid #8d6c43;
  outline-offset: 1px;
}

.chat-widget.is-collapsed {
  display: none;
}

.chat-reopen {
  position: fixed;
  right: 16px;
  bottom: 16px;
  border: none;
  border-radius: 50%;
  width: 58px;
  height: 58px;
  padding: 0;
  background: #a78165;
  border: 1px solid rgba(255, 255, 255, 0.28);
  box-shadow: 0 10px 26px rgba(26, 27, 32, 0.24);
  cursor: pointer;
  z-index: 20;
  display: grid;
  place-items: center;
  animation: reopen-pulse 2.6s ease-in-out infinite;
}

.chat-reopen.hidden-reopen {
  display: none;
}

.chat-reopen-logo {
  width: 48px;
  height: 48px;
  display: block;
  object-fit: contain;
  border-radius: 50%;
  filter: brightness(0) invert(1);
}

.attach-preview {
  margin: 0 14px 6px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffdf9;
  color: #747c8b;
  font-size: 12px;
}

.hidden-attach {
  display: none;
}

.emoji-picker {
  position: absolute;
  bottom: 86px;
  left: 12px;
  right: 12px;
  z-index: 50;
  width: auto;
  max-height: 360px;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(16, 18, 23, 0.2);
}

.hidden-emoji {
  display: none;
}

@keyframes msg-enter {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes reopen-pulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 10px 26px rgba(26, 27, 32, 0.24);
  }
  50% {
    transform: scale(1.03);
    box-shadow: 0 12px 28px rgba(26, 27, 32, 0.27);
  }
}

@media (max-width: 560px) {
  .chat-screen {
    padding: 0;
  }

  .chat-widget {
    width: 100%;
    height: 100dvh;
    max-height: none;
    border-radius: 0;
  }

  .brand-logo {
    width: clamp(140px, 44vw, 200px);
  }

  .message {
    max-width: 92%;
  }
}
