/* Besøkschatten på forsiden (nettside/js/chat.js). Bruker fargene fra forside.css. */
.chat-knapp {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 30;
  min-width: 64px;
  min-height: 64px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  background: var(--gronn);
  color: #fff;
  font: 600 .92rem var(--skrift);
  cursor: pointer;
  box-shadow: 0 12px 32px rgba(23, 52, 65, .22);
  transition: background .15s, transform .15s;
}
.chat-knapp:hover { background: var(--gronn-mork); }
.chat-knapp:active { transform: translateY(1px); }
.chat-knapp[aria-expanded="true"] { background: var(--blekk); }

.chat-panel {
  position: fixed;
  right: 20px;
  bottom: 96px;
  z-index: 30;
  display: flex;
  flex-direction: column;
  width: min(360px, calc(100vw - 40px));
  max-height: min(70vh, 600px);
  background: #fff;
  color: var(--blekk);
  border: 1px solid var(--linje);
  border-radius: 10px;
  box-shadow: 0 24px 64px rgba(23, 52, 65, .2);
  overflow: hidden;
}
.chat-panel__topp {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 10px 10px 18px;
  border-bottom: 1px solid var(--linje);
}
.chat-panel__tittel { font-family: var(--skrift); font-size: 1rem; font-weight: 650; margin: 0; }
.chat-panel__lukk {
  flex: none;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--dempa);
  font: 1.5rem/1 var(--skrift);
  cursor: pointer;
}
.chat-panel__lukk:hover { background: var(--flate); color: var(--blekk); }
.chat-panel__merknad {
  margin: 0;
  padding: 7px 18px;
  background: var(--flate);
  color: var(--dempa);
  font-size: .72rem;
}

.chat-logg {
  flex: 1 1 auto;
  min-height: 160px;
  overflow-y: auto;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 16px 16px 8px;
}
.chat-boble {
  max-width: 88%;
  margin: 0;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: .9rem;
  line-height: 1.5;
  white-space: pre-line;
}
.chat-boble--ki {
  justify-self: start;
  background: var(--flate);
  color: var(--blekk);
  border-bottom-left-radius: 4px;
}
.chat-boble--bruker {
  justify-self: end;
  background: var(--gronn);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-boble--venter { color: var(--dempa); letter-spacing: .15em; }
.chat-boble--feil { background: var(--feil-lys); color: var(--feil); }

.chat-skjema {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--linje);
}
.chat-skjema__felt {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 44px;
  max-height: 120px;
  padding: 10px 12px;
  border: 1px solid #aab9a7;
  border-radius: 8px;
  background: #fff;
  color: var(--blekk);
  /* 16 px eller mer, ellers zoomer iPhone inn når feltet får fokus */
  font: 400 1rem/1.4 var(--skrift);
  resize: none;
}
.chat-skjema__felt:focus { outline: none; border-color: var(--gronn); box-shadow: 0 0 0 3px var(--gronn-lys); }
.forside .chat-skjema__send { flex: none; min-height: 44px; }

@media (max-width: 639px) {
  .chat-knapp { right: 16px; bottom: 16px; min-height: 56px; min-width: 56px; padding-inline: 16px; }
  .chat-panel {
    right: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    max-height: 85vh;
    border-radius: 14px 14px 0 0;
    border-bottom: 0;
  }
  .chat-knapp[aria-expanded="true"] { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .chat-knapp { transition: none; }
}
