/* DELOCHAS chat widget — автономные стили. Все селекторы под .dw-chat, чтобы не задевать страницу. */
.dw-chat {
  --dw-accent: #c64a35;
  --dw-bg: #f2f1ed;
  --dw-surface: #ffffff;
  --dw-text: #1f1d1a;
  --dw-muted: #6f6a62;
  --dw-border: rgba(31, 29, 26, .14);
  --dw-radius: 14px;
  --dw-font: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  font-family: var(--dw-font);
  color: var(--dw-text);
}
.dw-chat.is-open { display: block; }
body.dw-chat-open { overflow: hidden; }

.dw-chat__overlay {
  position: absolute;
  inset: 0;
  background: rgba(28, 28, 30, .45);
}

.dw-chat__panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: 600px;
  height: 90vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--dw-bg);
  border: 1px solid var(--dw-border);
  border-radius: 16px 16px 0 0;
}

.dw-chat__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--dw-border);
}
.dw-chat__head-text { min-width: 0; }
.dw-chat__title { font-size: 1rem; font-weight: 600; letter-spacing: .02em; }
.dw-chat__sub { margin-top: 2px; font-size: .72rem; color: var(--dw-muted); }
.dw-chat__close {
  flex: none;
  padding: 0 6px;
  border: 0;
  background: none;
  color: var(--dw-muted);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

.dw-chat__body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  overflow-y: auto;
  background: var(--dw-bg);
}

.dw-bubble {
  max-width: 86%;
  padding: 10px 14px;
  border-radius: var(--dw-radius);
  font-size: 15px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.dw-bubble--bot {
  align-self: flex-start;
  background: var(--dw-surface);
  border: 1px solid var(--dw-border);
  border-bottom-left-radius: 4px;
}
.dw-bubble--me {
  align-self: flex-end;
  background: var(--dw-accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.dw-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.dw-actions button,
.dw-actions a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1.5px solid var(--dw-accent);
  border-radius: 10px;
  background: transparent;
  color: var(--dw-text);
  font: inherit;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
}
.dw-actions a.dw-primary { background: var(--dw-accent); color: #fff; font-weight: 600; }

.dw-typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 10px 14px;
  background: var(--dw-surface);
  border: 1px solid var(--dw-border);
  border-radius: var(--dw-radius);
}
.dw-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--dw-muted);
  animation: dw-typing 1s infinite;
}
.dw-typing span:nth-child(2) { animation-delay: .2s; }
.dw-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes dw-typing { 0%, 100% { opacity: .3; } 50% { opacity: 1; } }

.dw-chat__consent {
  padding: 0 16px 8px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--dw-muted);
}
.dw-chat__consent a { color: var(--dw-text); border-bottom: 1px dotted var(--dw-muted); }

.dw-chat__foot {
  display: flex;
  gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--dw-border);
  background: var(--dw-surface);
}
.dw-chat__input {
  flex: 1;
  min-height: 44px;
  padding: 0 14px;
  border: 1.5px solid var(--dw-border);
  border-radius: 12px;
  background: var(--dw-surface);
  color: var(--dw-text);
  font: inherit;
  font-size: 16px;
}
.dw-chat__input:focus { outline: 0; border-color: var(--dw-accent); }
.dw-chat__send {
  min-width: 52px;
  border: 0;
  border-radius: 12px;
  background: var(--dw-accent);
  color: #fff;
  font-size: 20px;
  font-weight: 600;
  cursor: pointer;
}

.dw-chat__launcher {
  position: fixed;
  right: 20px;
  bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: 9998;
  padding: 12px 18px;
  border: 0;
  border-radius: 999px;
  background: var(--dw-accent, #c64a35);
  color: #fff;
  font: 600 14px/1.2 var(--dw-font, system-ui, sans-serif);
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
}
.dw-chat.is-open .dw-chat__launcher { display: none; }

@media (min-width: 900px) {
  .dw-chat { background: transparent; }
  .dw-chat__panel {
    left: auto;
    right: 32px;
    bottom: 24px;
    width: 420px;
    max-width: calc(100vw - 64px);
    height: min(640px, calc(100vh - 120px));
    border-radius: 16px;
  }
}
