:root {
  color-scheme: light;
  --bg: #f3f6f4;
  --panel: #ffffff;
  --text: #18201c;
  --muted: #63706a;
  --line: #d9e1dc;
  --accent: #18785f;
  --accent-dark: #0f5d49;
  --operator: #eef7f4;
  --user: #e8f0ff;
  --danger: #a53636;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    linear-gradient(135deg, rgba(24, 120, 95, 0.08), transparent 36%),
    var(--bg);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
textarea,
input {
  font: inherit;
}

.shell {
  width: min(920px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px 16px;
  display: flex;
}

.chat {
  width: 100%;
  min-height: calc(100vh - 56px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(20, 35, 28, 0.08);
}

.chat__header {
  padding: 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

h1 {
  margin: 0 0 6px;
  font-size: 24px;
  line-height: 1.15;
  letter-spacing: 0;
}

p {
  margin: 0;
  color: var(--muted);
}

.session {
  max-width: 360px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.session span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.session strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 650;
}

.messages {
  min-height: 360px;
  padding: 18px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.empty {
  margin: auto;
  color: var(--muted);
  text-align: center;
}

.message {
  width: min(72%, 620px);
  padding: 11px 13px;
  border-radius: 8px;
  border: 1px solid var(--line);
  overflow-wrap: anywhere;
}

.message--user {
  align-self: flex-end;
  background: var(--user);
}

.message--operator {
  align-self: flex-start;
  background: var(--operator);
}

.message__meta {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}

.message__text {
  white-space: pre-wrap;
  line-height: 1.45;
}

.attachment {
  display: inline-flex;
  margin-top: 8px;
  color: var(--accent-dark);
  font-weight: 650;
  text-decoration: none;
}

.composer {
  padding: 14px;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: end;
  gap: 10px;
  background: #fbfcfb;
}

.composer__body {
  min-width: 0;
}

textarea {
  width: 100%;
  min-height: 52px;
  max-height: 180px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--text);
  background: #fff;
  outline: none;
}

textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(24, 120, 95, 0.14);
}

.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.file-button span,
button {
  min-height: 44px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 0 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: var(--accent-dark);
  font-weight: 650;
  cursor: pointer;
}

button {
  background: var(--accent);
  color: #fff;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.file-preview {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.file-preview.is-error {
  color: var(--danger);
}

@media (max-width: 680px) {
  .shell {
    padding: 0;
  }

  .chat {
    min-height: 100vh;
    border: 0;
    border-radius: 0;
  }

  .chat__header {
    flex-direction: column;
  }

  .session {
    width: 100%;
    max-width: none;
  }

  .messages {
    padding: 14px;
  }

  .message {
    width: min(90%, 620px);
  }

  .composer {
    grid-template-columns: 1fr auto;
  }

  .composer__body {
    grid-column: 1 / -1;
    grid-row: 1;
  }
}
