.dac-root {
  --dac-color: #d71920;
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 99999;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.45;
}
.dac-root *, .dac-root *::before, .dac-root *::after { box-sizing: border-box; }

.dac-launcher {
  width: 60px; height: 60px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--dac-color); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 20px rgba(0,0,0,.22);
  transition: transform .15s ease;
  margin-left: auto;
}
.dac-launcher:hover { transform: scale(1.06); }
.dac-launcher:focus-visible { outline: 3px solid #111; outline-offset: 3px; }
.dac-open .dac-launcher { display: none; }

.dac-panel {
  width: 370px; max-width: calc(100vw - 32px);
  height: 560px; max-height: calc(100vh - 40px);
  background: #fff; color: #1d1d1f;
  border-radius: 16px; overflow: hidden;
  box-shadow: 0 12px 40px rgba(0,0,0,.25);
  display: flex; flex-direction: column;
}
.dac-panel[hidden] { display: none; }

.dac-head {
  background: var(--dac-color); color: #fff;
  padding: 14px 14px 14px 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.dac-title { font-weight: 700; font-size: 16px; }
.dac-actions { display: flex; align-items: center; gap: 6px; }
.dac-actions button, .dac-wa {
  background: rgba(255,255,255,.18); color: #fff; border: 0; cursor: pointer;
  border-radius: 8px; height: 30px; min-width: 30px; padding: 0 8px;
  font-size: 18px; line-height: 30px; text-decoration: none;
}
.dac-wa { font-size: 13px; font-weight: 600; }
.dac-actions button:hover, .dac-wa:hover { background: rgba(255,255,255,.3); color: #fff; }

.dac-log {
  flex: 1; overflow-y: auto; padding: 14px;
  background: #f5f5f7; display: flex; flex-direction: column; gap: 8px;
}
.dac-msg {
  max-width: 85%; padding: 9px 12px; border-radius: 14px;
  white-space: pre-wrap; word-wrap: break-word;
}
.dac-assistant { background: #fff; align-self: flex-start; border-bottom-left-radius: 4px; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.dac-user { background: var(--dac-color); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.dac-user a { color: #fff; }
.dac-assistant a { color: var(--dac-color); }
.dac-typing { color: #6e6e73; font-style: italic; }
.dac-error { background: #fff4f4; color: #8a1c1c; }

.dac-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px; background: #f5f5f7; }
.dac-chips:not(:empty) { padding-bottom: 10px; }
.dac-chip {
  border: 1px solid var(--dac-color); color: var(--dac-color); background: #fff;
  border-radius: 999px; padding: 5px 11px; font-size: 13px; cursor: pointer;
}
.dac-chip:hover { background: var(--dac-color); color: #fff; }

.dac-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid #e5e5ea; background: #fff; }
.dac-input {
  flex: 1; resize: none; border: 1px solid #d2d2d7; border-radius: 12px;
  padding: 9px 12px; font: inherit; color: inherit; background: #fff; max-height: 120px;
}
.dac-input:focus { outline: none; border-color: var(--dac-color); }
.dac-send {
  width: 42px; border: 0; border-radius: 12px; cursor: pointer;
  background: var(--dac-color); color: #fff; font-size: 17px;
}
.dac-send:disabled { opacity: .5; cursor: default; }
.dac-note { font-size: 11px; color: #86868b; text-align: center; padding: 0 10px 8px; background: #fff; }

@media (max-width: 480px) {
  .dac-root { right: 12px; bottom: 12px; }
  .dac-open { left: 0; right: 0; bottom: 0; top: 0; }
  .dac-open .dac-panel { width: 100vw; max-width: 100vw; height: 100%; max-height: 100%; border-radius: 0; }
}

/* Ochrona przed stylami motywu strony */
.dac-root .dac-form { align-items: flex-end; margin: 0; }
.dac-root .dac-input {
  height: 42px; min-height: 42px; margin: 0; box-shadow: none; text-transform: none;
  letter-spacing: normal; font-size: 15px; line-height: 1.4; width: auto;
}
.dac-root .dac-input::placeholder { text-transform: none; letter-spacing: normal; color: #86868b; opacity: 1; }
.dac-root .dac-send, .dac-root .dac-actions button, .dac-root .dac-chip, .dac-root .dac-launcher {
  text-transform: none; letter-spacing: normal; box-shadow: none; margin: 0; line-height: 1.2; font-family: inherit;
}
.dac-root .dac-send { height: 42px; min-height: 0; padding: 0; flex: 0 0 42px; }
.dac-root .dac-launcher { box-shadow: 0 6px 20px rgba(0,0,0,.22); padding: 0; }
.dac-root .dac-chip { padding: 5px 11px; font-size: 13px; font-weight: 400; }
.dac-root .dac-actions button { padding: 0 8px; height: 30px; min-height: 0; font-size: 18px; }
