:root {
  color-scheme: light;
  --ink: #14372e;
  --ink-soft: #527168;
  --pine: #173f34;
  --pine-deep: #0f3028;
  --mint: #dff2df;
  --mint-strong: #b9dfbd;
  --cream: #f4f1e8;
  --paper: #fffdf8;
  --line: #dfe7df;
  --white: #ffffff;
  --shadow: 0 24px 70px rgba(24, 59, 49, 0.14);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  background: var(--cream);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 78% 10%, rgba(185, 223, 189, 0.46), transparent 29rem),
    linear-gradient(135deg, #f7f4ec 0%, #edf3e9 100%);
}

button,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

.page-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(270px, 344px) minmax(0, 1fr);
}

.sidebar {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 38px clamp(28px, 3vw, 48px) 34px;
  color: #eff8ef;
  overflow: hidden;
  background:
    linear-gradient(155deg, rgba(255, 255, 255, 0.04), transparent 38%),
    var(--pine);
}

.sidebar::before,
.sidebar::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(223, 242, 223, 0.11);
  border-radius: 50%;
  pointer-events: none;
}

.sidebar::before {
  width: 360px;
  height: 360px;
  right: -255px;
  top: 28%;
}

.sidebar::after {
  width: 250px;
  height: 250px;
  left: -180px;
  bottom: -90px;
}

.brand {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  width: fit-content;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 13px 13px 13px 4px;
  color: var(--pine-deep);
  background: var(--mint-strong);
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
  letter-spacing: 0.08em;
  font-size: 13px;
  font-weight: 750;
}

.brand-copy small {
  margin-top: 5px;
  color: rgba(239, 248, 239, 0.6);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.sidebar-intro {
  position: relative;
  z-index: 1;
  margin-top: clamp(66px, 9vh, 112px);
}

.eyebrow {
  margin: 0 0 17px;
  color: var(--mint-strong);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.sidebar h1 {
  max-width: 270px;
  margin: 0;
  color: var(--white);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(34px, 3.1vw, 50px);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1.02;
}

.sidebar-intro > p:last-child {
  max-width: 255px;
  margin: 24px 0 0;
  color: rgba(239, 248, 239, 0.68);
  font-size: 14px;
  line-height: 1.65;
}

.help-card {
  position: relative;
  z-index: 1;
  margin-top: 42px;
  padding: 22px 20px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.055);
  backdrop-filter: blur(8px);
}

.help-card-title {
  margin: 0 0 15px;
  color: rgba(239, 248, 239, 0.54);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.help-card ul {
  display: grid;
  gap: 11px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.help-card li {
  display: flex;
  gap: 11px;
  align-items: center;
  color: rgba(255, 255, 255, 0.85);
  font-size: 12px;
}

.help-card li span {
  color: var(--mint-strong);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.08em;
}

.privacy-note {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: auto;
  padding-top: 30px;
}

.shield {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 29px;
  height: 32px;
  border-radius: 14px 14px 18px 18px;
  color: var(--pine-deep);
  background: var(--mint-strong);
  font-size: 12px;
  font-weight: 800;
}

.privacy-note strong {
  display: block;
  margin-top: 1px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 11px;
  letter-spacing: 0.03em;
}

.privacy-note p {
  max-width: 220px;
  margin: 5px 0 0;
  color: rgba(239, 248, 239, 0.51);
  font-size: 10px;
  line-height: 1.5;
}

.chat-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 100vh;
  padding: 32px clamp(22px, 6vw, 84px) 20px;
}

.chat-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(880px, 100%);
  height: min(780px, calc(100vh - 76px));
  min-height: 610px;
  overflow: hidden;
  border: 1px solid rgba(32, 74, 61, 0.1);
  border-radius: 29px;
  background: rgba(255, 253, 248, 0.93);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 92px;
  padding: 20px clamp(22px, 4vw, 38px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.agent-identity {
  display: flex;
  align-items: center;
  gap: 14px;
}

.agent-avatar {
  position: relative;
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  border: 3px solid var(--white);
  border-radius: 18px 18px 18px 7px;
  background: var(--white) url("/agent-icon.png") center / cover no-repeat;
  box-shadow: 0 9px 22px rgba(23, 63, 52, 0.18);
}

.agent-avatar::before {
  content: "";
  position: absolute;
  z-index: 1;
  bottom: 12px;
  left: 22px;
  width: 3px;
  height: 3px;
  border-radius: 1px;
  opacity: 0;
  background: #f4e817;
  box-shadow: 5px 0 #f4e817, 10px 0 #f4e817;
}

.agent-avatar > span {
  display: none;
}

.agent-avatar i {
  position: absolute;
  right: -2px;
  bottom: 1px;
  width: 14px;
  height: 14px;
  border: 3px solid var(--white);
  border-radius: 50%;
  background: #58a56b;
  box-shadow: 0 2px 7px rgba(31, 91, 53, 0.28);
}

.chat-card.is-writing .agent-avatar {
  animation: agent-writing 520ms steps(2, end) infinite;
}

.chat-card.is-writing .agent-avatar::before {
  animation: keyboard-taps 520ms steps(2, end) infinite;
}

.agent-identity h2 {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  font-weight: 750;
  letter-spacing: -0.01em;
}

.agent-identity p {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 6px 0 0;
  color: var(--ink-soft);
  font-size: 11px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #67a773;
  box-shadow: 0 0 0 4px rgba(103, 167, 115, 0.12);
}

.header-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 12px;
  border: 1px solid #d9e4d7;
  border-radius: 999px;
  color: #5b736a;
  background: #f6faf3;
  font-size: 10px;
  font-weight: 650;
}

.header-badge span {
  color: #6ba271;
  font-size: 14px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.reset-button {
  min-height: 35px;
  padding: 0 12px;
  border: 1px solid #d9e4d7;
  border-radius: 999px;
  color: #4e6b61;
  background: var(--white);
  cursor: pointer;
  font-size: 10px;
  font-weight: 650;
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.reset-button:hover {
  border-color: #aacaac;
  color: var(--pine);
  background: #f6faf3;
}

.conversation {
  min-height: 0;
  overflow-y: auto;
  padding: 20px clamp(22px, 4vw, 38px) 26px;
  scrollbar-color: #cbd9ce transparent;
  scrollbar-width: thin;
}

.date-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 2px 0 23px;
  color: #899b94;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.date-divider::before,
.date-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: #e7ebe5;
}

.message-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.message-avatar {
  position: relative;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  margin-top: 20px;
  border: 2px solid var(--white);
  border-radius: 11px 11px 11px 4px;
  background: var(--white) url("/agent-icon.png") center / cover no-repeat;
  box-shadow: 0 5px 14px rgba(23, 63, 52, 0.15);
}

.writing-message .message-avatar {
  animation: message-avatar-writing 420ms steps(2, end) infinite;
}

.message-content {
  max-width: min(610px, calc(100% - 43px));
}

.sender {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 7px 3px;
  color: #4f6a61;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.assistant-message .sender::after {
  content: "Kundservice";
  padding: 3px 6px;
  border-radius: 999px;
  color: #668078;
  background: #eaf3e7;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.message-bubble {
  padding: 16px 18px;
  border: 1px solid #dce5dc;
  border-radius: 5px 19px 19px 19px;
  color: #284b40;
  background: var(--white);
  box-shadow: 0 7px 22px rgba(28, 65, 53, 0.06);
  font-size: 13px;
  line-height: 1.62;
  white-space: pre-wrap;
}

.message-bubble p {
  margin: 0;
}

.message-bubble p + p {
  margin-top: 10px;
}

.message-content time {
  display: block;
  margin: 6px 0 0 4px;
  color: #98a49f;
  font-size: 9px;
}

.user-message {
  justify-content: flex-end;
  margin: 25px 0;
}

.user-message .message-content {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.user-message .sender {
  margin-right: 3px;
}

.user-message .message-bubble {
  border-color: var(--pine);
  border-radius: 19px 5px 19px 19px;
  color: var(--white);
  background: var(--pine);
  box-shadow: 0 8px 22px rgba(23, 63, 52, 0.16);
}

.error-message .message-bubble {
  border-color: #ead8cd;
  color: #754630;
  background: #fff8f3;
}

.typing-bubble {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 66px;
  min-height: 48px;
}

.typing-bubble span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #83a096;
  animation: typing 1.15s infinite ease-in-out;
}

.typing-bubble span:nth-child(2) {
  animation-delay: 140ms;
}

.typing-bubble span:nth-child(3) {
  animation-delay: 280ms;
}

@keyframes typing {
  0%,
  60%,
  100% {
    opacity: 0.34;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

@keyframes agent-writing {
  0%,
  100% {
    transform: translateY(0) rotate(-0.8deg);
  }
  50% {
    transform: translateY(1px) rotate(0.8deg);
  }
}

@keyframes keyboard-taps {
  0%,
  100% {
    opacity: 0.25;
    transform: translateY(0);
  }
  50% {
    opacity: 0.95;
    transform: translateY(2px);
  }
}

@keyframes message-avatar-writing {
  0%,
  100% {
    transform: translateY(0) rotate(-1deg);
  }
  50% {
    transform: translateY(1px) rotate(1deg);
  }
}

.suggestions {
  margin: 31px 0 0 43px;
}

.suggestions > p {
  margin: 0 0 10px 2px;
  color: #899b94;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.suggestion-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.suggestion-list button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 37px;
  padding: 8px 13px;
  border: 1px solid #d6e2d6;
  border-radius: 11px;
  color: #345c50;
  background: #f6faf3;
  cursor: pointer;
  font-size: 11px;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.suggestion-list button span {
  color: #76a97b;
}

.suggestion-list button:hover {
  border-color: #aacaac;
  background: #eef7eb;
  transform: translateY(-1px);
}

.suggestion-list button:focus-visible,
.send-button:focus-visible,
.reset-button:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(106, 164, 114, 0.28);
  outline-offset: 2px;
}

.composer-wrap {
  padding: 18px clamp(22px, 4vw, 38px) 17px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.8);
}

.composer {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 8px 8px 8px 17px;
  border: 1px solid #ccd9cc;
  border-radius: 17px;
  background: var(--white);
  box-shadow: 0 8px 24px rgba(28, 65, 53, 0.05);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.composer:focus-within {
  border-color: #8bb98f;
  box-shadow: 0 0 0 4px rgba(139, 185, 143, 0.12);
}

textarea {
  flex: 1;
  min-width: 0;
  max-height: 130px;
  resize: none;
  border: 0;
  outline: 0;
  padding: 11px 0 9px;
  color: var(--ink);
  background: transparent;
  font-size: 13px;
  line-height: 1.45;
}

textarea::placeholder {
  color: #9daaa4;
}

.send-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 43px;
  padding: 0 15px 0 17px;
  border: 0;
  border-radius: 12px;
  color: var(--white);
  background: var(--pine);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  transition: background 160ms ease, transform 160ms ease;
}

.send-button:hover {
  background: #205647;
  transform: translateY(-1px);
}

.send-button:disabled,
.reset-button:disabled,
.suggestion-list button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.send-button b {
  color: var(--mint-strong);
  font-size: 15px;
}

.composer-note {
  margin: 9px 3px 0;
  color: #93a19b;
  font-size: 9px;
}

.local-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 13px 0 0;
  color: #73877f;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.local-label span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #72a778;
}

.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;
}

@media (max-width: 860px) {
  .page-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
    padding: 22px 24px;
  }

  .sidebar-intro,
  .help-card,
  .privacy-note {
    display: none;
  }

  .brand-mark {
    width: 37px;
    height: 37px;
  }

  .chat-area {
    min-height: calc(100vh - 81px);
    padding: 18px 14px 10px;
  }

  .chat-card {
    height: calc(100vh - 117px);
    min-height: 540px;
    border-radius: 22px;
  }
}

@media (max-width: 560px) {
  .chat-header {
    min-height: 78px;
    padding: 15px 17px;
  }

  .agent-avatar {
    width: 42px;
    height: 42px;
    border-radius: 14px 14px 14px 6px;
  }

  .header-badge {
    display: none;
  }

  .conversation {
    padding: 17px;
  }

  .message-avatar {
    display: none;
  }

  .message-content {
    max-width: 100%;
  }

  .suggestions {
    margin-left: 0;
  }

  .suggestion-list {
    flex-direction: column;
  }

  .suggestion-list button {
    width: 100%;
  }

  .composer-wrap {
    padding: 12px 13px;
  }

  .send-button span {
    display: none;
  }

  .send-button {
    width: 43px;
    padding: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
