/* ---------- Chattassistent ---------- */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.chatt-knapp {
  position: fixed; right: 20px; bottom: 20px; z-index: 60;
  display: inline-flex; align-items: center; gap: 10px;
  padding: 13px 20px; border: 0; border-radius: var(--r-full);
  background: var(--btn-bg); color: var(--btn-fg);
  font: 600 15px/1 var(--font-sans); cursor: pointer;
  box-shadow: 0 6px 24px rgba(22, 24, 29, 0.18);
  transition: transform 0.2s var(--ease-out), opacity 0.2s;
}
.chatt-knapp:hover { transform: translateY(-2px); }
.chatt-knapp.dold { opacity: 0; pointer-events: none; }
.chatt-prick { width: 8px; height: 8px; background: var(--accent-soft); }

.chatt-panel {
  position: fixed; right: 20px; bottom: 20px; z-index: 61;
  width: 380px; max-width: calc(100vw - 32px);
  height: 560px; max-height: calc(100vh - 40px);
  display: flex; flex-direction: column;
  background: var(--card-bg); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: 0 16px 48px rgba(22, 24, 29, 0.2);
  overflow: hidden;
}
.chatt-panel[hidden] { display: none; }

.chatt-huvud {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 18px; background: var(--invert-bg); color: var(--invert-fg);
}
.chatt-huvud strong { display: block; font: 600 16px/1.2 var(--font-display); letter-spacing: -0.01em; }
.chatt-huvud span { display: block; margin-top: 3px; font: 11px/1 var(--font-mono); text-transform: uppercase; letter-spacing: 0.12em; color: var(--accent-soft); }
.chatt-stang {
  width: 32px; height: 32px; border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--invert-fg); font-size: 24px; line-height: 1; cursor: pointer;
}
.chatt-stang:hover { background: var(--invert-line); }

.chatt-logg {
  flex: 1; overflow-y: auto; padding: 18px;
  display: flex; flex-direction: column; gap: 10px;
  background: var(--bg);
}
.chatt-bubbla {
  max-width: 85%; padding: 10px 14px; border-radius: var(--r-md);
  font-size: 14.5px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere;
}
.chatt-assistant { align-self: flex-start; background: var(--card-bg); border: 1px solid var(--line); border-bottom-left-radius: 2px; }
.chatt-user { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 2px; }

.chatt-skriver { display: inline-flex; gap: 5px; padding: 14px 16px; }
.chatt-skriver span { width: 6px; height: 6px; background: var(--ink-faint); animation: chatt-puls 1.2s infinite; }
.chatt-skriver span:nth-child(2) { animation-delay: 0.15s; }
.chatt-skriver span:nth-child(3) { animation-delay: 0.3s; }
@keyframes chatt-puls { 0%, 60%, 100% { opacity: 0.25; } 30% { opacity: 1; } }

.chatt-forslag { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 18px; background: var(--bg); }
.chatt-forslag:not(:empty) { padding-bottom: 12px; }
.chatt-forslag button {
  padding: 7px 12px; border: 1px solid var(--line); border-radius: var(--r-full);
  background: var(--card-bg); color: var(--ink); font: 500 13px/1.2 var(--font-sans); cursor: pointer;
}
.chatt-forslag button:hover { border-color: var(--accent); color: var(--accent); }

.chatt-form { display: flex; gap: 8px; align-items: flex-end; padding: 12px; border-top: 1px solid var(--line); }
.chatt-form textarea {
  flex: 1; resize: none; max-height: 120px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--bg); color: var(--ink); font: 14.5px/1.4 var(--font-sans);
}
.chatt-form textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.chatt-form button {
  flex: none; width: 42px; height: 42px; border: 0; border-radius: var(--r-sm);
  background: var(--btn-bg); color: var(--btn-fg); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.chatt-fot { margin: 0; padding: 0 12px 10px; font-size: 11px; color: var(--ink-faint); }

@media (max-width: 520px) {
  .chatt-knapp { right: 16px; bottom: 16px; }
  .chatt-panel { right: 0; bottom: 0; width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; border: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .chatt-knapp, .chatt-skriver span { transition: none; animation: none; }
}
.form-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
