:root {
  --bps-green: #008a6b;
  --bps-green-dark: #007257;
  --bps-green-soft: #e7f4f0;
  --bps-lime: #c5d92d;
  --bg: #ffffff;
  --surface: #ffffff;
  --ink: #1d2529;
  --muted: #657174;
  --line: #dfe8e5;
  --assistant: #f7faf9;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

.page {
  width: min(980px, calc(100% - 32px));
  margin: 0 auto;
  min-height: 100vh;
  padding: 42px 0;
  display: grid;
  gap: 22px;
  align-items: start;
}

.hero {
  padding-bottom: 12px;
  border-bottom: 3px solid var(--bps-lime);
}

h1 {
  margin: 0;
  color: var(--bps-green);
  font-size: 34px;
  line-height: 1.18;
  font-weight: 700;
}

.lead {
  margin: 10px 0 0;
  font-size: 17px;
  line-height: 1.5;
  color: var(--muted);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 14px 36px rgba(0, 80, 64, 0.08);
  padding: 18px;
}

.messages {
  min-height: 440px;
  max-height: 64vh;
  overflow: auto;
  padding: 6px 0 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.message {
  display: flex;
}

.message.user {
  justify-content: flex-end;
}

.bubble {
  max-width: min(720px, 92%);
  border-radius: 8px;
  padding: 14px 16px;
  background: var(--assistant);
  border: 1px solid var(--line);
}

.message.user .bubble {
  background: var(--bps-green);
  border-color: var(--bps-green);
  color: white;
}

.bubble p {
  margin: 0;
  line-height: 1.58;
  white-space: pre-wrap;
}

.pending {
  color: var(--muted);
}

.badge {
  display: inline-flex;
  margin-bottom: 10px;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge.firmowe {
  background: var(--bps-green-soft);
  color: var(--bps-green-dark);
}

.badge.ogolna {
  background: #fff8d8;
  color: #7b6400;
}

.sources {
  margin: 14px 0 0;
  padding-left: 18px;
  color: var(--muted);
}

.sources li {
  margin-bottom: 8px;
}

.sources a {
  color: var(--bps-green);
  font-weight: 700;
  text-decoration: none;
  margin-left: 8px;
}

.sources a:hover {
  text-decoration: underline;
}

.composer {
  display: grid;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

textarea {
  width: 100%;
  resize: vertical;
  min-height: 88px;
  padding: 15px 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  font: inherit;
  background: white;
  color: var(--ink);
}

textarea:focus {
  outline: 2px solid rgba(0, 138, 107, 0.18);
  border-color: var(--bps-green);
}

button {
  justify-self: end;
  border: 0;
  border-radius: 999px;
  padding: 13px 24px;
  background: var(--bps-green);
  color: white;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 20px rgba(0, 138, 107, 0.18);
}

button:hover {
  background: var(--bps-green-dark);
}

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

@media (max-width: 720px) {
  .page {
    width: min(100% - 24px, 980px);
    padding: 24px 0;
  }

  h1 {
    font-size: 28px;
  }

  .panel {
    padding: 12px;
  }

  .messages {
    min-height: 380px;
  }

  .bubble {
    max-width: 100%;
  }
}
