:root {
  --page-bg: #090909;
  --panel-bg: #111111;
  --assistant-bubble: #181818;
  --user-bubble: #f2f2f2;
  --user-text: #111111;
  --text-primary: #f5f5f5;
  --text-secondary: #8a8a8a;
  --border: rgba(255, 255, 255, 0.08);
  --input-bg: #161616;
  --danger-text: #cfcfcf;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--page-bg);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.layout {
  width: 100%;
  max-width: 1040px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

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

.chat {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 760px;
  height: 80vh;
  max-height: 820px;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat__header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.chat__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 14px;
  flex-shrink: 0;
}

.chat__heading h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.chat__heading p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-secondary);
}

.chat__messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.msg {
  display: flex;
  animation: msg-in 200ms ease-out;
}

@keyframes msg-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .msg {
    animation: none;
  }
}

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

.msg--assistant {
  justify-content: flex-start;
}

.msg__bubble {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.msg--assistant .msg__bubble {
  background: var(--assistant-bubble);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.msg--user .msg__bubble {
  background: var(--user-bubble);
  color: var(--user-text);
}

.msg--system .msg__bubble {
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--text-secondary);
  font-size: 13px;
}

.msg__group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 78%;
}

.msg--assistant .msg__group {
  align-items: flex-start;
}

.provenance {
  border: 1px solid var(--border);
  background: #141414;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.provenance__label {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 10px;
  color: var(--text-secondary);
  margin-bottom: 2px;
}

.provenance__line {
  color: var(--text-primary);
}

.typing {
  display: inline-flex;
  gap: 4px;
  padding: 4px 2px;
}

.typing span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-secondary);
  animation: typing-bounce 1s infinite ease-in-out;
}

.typing span:nth-child(2) {
  animation-delay: 0.15s;
}

.typing span:nth-child(3) {
  animation-delay: 0.3s;
}

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

@media (prefers-reduced-motion: reduce) {
  .typing span {
    animation: none;
    opacity: 0.6;
  }
}

.suggestions {
  flex-shrink: 0;
  padding: 0 20px 16px;
}

.suggestions__label {
  margin: 0 0 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}

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

.suggestion {
  font-family: inherit;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--text-primary);
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
  text-align: left;
}

.suggestion:hover:not(:disabled) {
  background: #1c1c1c;
}

.suggestion:focus-visible {
  outline: 2px solid var(--text-secondary);
  outline-offset: 2px;
}

.suggestion:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

@media (max-width: 600px) {
  .suggestions {
    padding: 0 12px 12px;
  }
}

.chat__input {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.chat__input textarea {
  flex: 1;
  resize: none;
  max-height: 120px;
  background: var(--input-bg);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  line-height: 1.4;
}

.chat__input textarea::placeholder {
  color: var(--text-secondary);
}

.chat__input textarea:focus-visible,
.chat__input button:focus-visible {
  outline: 2px solid var(--text-secondary);
  outline-offset: 2px;
}

.chat__input button {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.chat__input button:hover:not(:disabled) {
  background: #1c1c1c;
}

.chat__input button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Right-side example-question panel: a persistent reference of what the
 * knowledge base covers, separate from the fresh-chat suggestions above -
 * it never hides itself once the conversation starts. */
.examples {
  flex-shrink: 0;
  width: 260px;
  height: 80vh;
  max-height: 820px;
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Always renders the "Example questions" heading. On desktop it is a plain
 * (non-interactive-looking) header - the panel is always open there and
 * clicking it has no visual effect. Only below the 900px breakpoint does it
 * become the drawer's toggle affordance (chevron, pointer cursor). */
.examples__toggle {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 16px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: default;
}

.examples__chevron {
  display: none;
  flex-shrink: 0;
  transition: transform 150ms ease-out;
}

.examples__toggle[aria-expanded="true"] .examples__chevron {
  transform: rotate(180deg);
}

.examples__content {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
  padding: 16px;
  border-top: 1px solid var(--border);
}

.examples__hint {
  margin: 0 0 12px;
  font-size: 11px;
  color: var(--text-secondary);
}

.examples__scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.examples__group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.examples__category {
  margin: 0;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}

.example {
  font-family: inherit;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--text-primary);
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
  cursor: pointer;
  text-align: left;
}

.example:hover:not(:disabled) {
  background: #1c1c1c;
}

.example:focus-visible {
  outline: 2px solid var(--text-secondary);
  outline-offset: 2px;
}

.example:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

@media (max-width: 900px) {
  .layout {
    flex-direction: column;
    align-items: stretch;
  }

  .chat {
    max-width: none;
  }

  /* Panel becomes a compact collapsible drawer above the composer instead of
   * squeezing into the chat's width - the chat keeps its full, readable size. */
  .examples {
    width: 100%;
    height: auto;
    max-height: none;
    order: 2;
  }

  .examples__toggle {
    cursor: pointer;
  }

  .examples__chevron {
    display: block;
  }

  .examples__content {
    max-height: 0;
    padding: 0 16px;
    border-top: none;
    overflow: hidden;
    transition: max-height 180ms ease-out;
  }

  .examples--open .examples__content {
    max-height: 60vh;
    padding: 0 16px 16px;
    border-top: 1px solid var(--border);
  }

  .examples__scroll {
    max-height: 45vh;
  }
}

@media (max-width: 600px) {
  body {
    padding: 8px;
  }

  .chat {
    height: 96vh;
    max-height: none;
    border-radius: 10px;
  }

  .msg__bubble,
  .msg__group {
    max-width: 88%;
  }
}
