:root {
  color-scheme: light;
  --ink: #111827;
  --muted: #687386;
  --line: #dce2e9;
  --paper: #f7f8f5;
  --white: #ffffff;
  --green: #1d6f52;
  --green-dark: #15533d;
  --green-soft: #e7f3ed;
  --gold: #c9a94f;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    sans-serif;
}

* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
}
button,
input,
textarea {
  font: inherit;
}
button,
.button {
  cursor: pointer;
}
.hidden {
  display: none !important;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.shell {
  min-height: 100dvh;
  width: min(760px, 100%);
  margin: 0 auto;
  background: var(--white);
  border-inline: 1px solid var(--line);
}
header {
  height: 72px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
  font-size: 23px;
  letter-spacing: -0.04em;
}
.brand span {
  color: var(--green);
}
.quiet {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px;
}

.auth-card {
  max-width: 520px;
  margin: 10vh auto;
  padding: 36px;
}
.eyebrow {
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 12px;
  font-weight: 800;
  margin: 0 0 12px;
}
h1 {
  font-size: clamp(32px, 6vw, 48px);
  line-height: 1.03;
  letter-spacing: -0.045em;
  margin: 0;
}
.intro {
  color: var(--muted);
  line-height: 1.6;
  margin: 20px 0 28px;
}
label {
  display: block;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 8px;
}
input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  background: var(--white);
  outline: none;
}
input {
  padding: 15px 16px;
}
input:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-soft);
}
.auth-actions {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}
.auth-option button {
  width: 100%;
  margin-top: 14px;
}
button,
.button {
  border: 0;
  border-radius: 12px;
  padding: 14px 18px;
  background: var(--green);
  color: white;
  font-weight: 750;
  text-align: center;
  text-decoration: none;
}
button:hover,
.button:hover {
  background: var(--green-dark);
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}
.telegram-chip {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 22px;
  padding: 9px 13px;
  border: 1px solid #c9ddd4;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  text-decoration: none;
}
.telegram-chip:hover {
  background: #dceee5;
  border-color: #a9cbbd;
}
.telegram-chip:focus-visible {
  outline: 3px solid rgb(29 111 82 / 22%);
  outline-offset: 3px;
}
.telegram-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgb(29 111 82 / 10%);
}
.verify {
  margin-top: 24px;
  padding: 18px;
  border-radius: 16px;
  background: var(--green-soft);
}
.verify p {
  margin-top: 0;
  line-height: 1.5;
}
.error {
  color: #b42318;
  min-height: 22px;
  font-size: 14px;
}

.chat {
  height: calc(100dvh - 72px);
  display: grid;
  grid-template-rows: 1fr auto auto;
}
.messages {
  overflow-y: auto;
  padding: 28px 24px 12px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.message {
  max-width: min(82%, 560px);
  white-space: pre-wrap;
  line-height: 1.5;
  padding: 13px 16px;
  border-radius: 18px;
}
.message.assistant {
  align-self: flex-start;
  background: #f0f2f2;
  border-bottom-left-radius: 5px;
}
.message.user {
  align-self: flex-end;
  background: var(--green);
  color: white;
  border-bottom-right-radius: 5px;
}
.message-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 11px;
}
.message-actions button,
.message-actions a {
  padding: 9px 12px;
  border-radius: 999px;
  background: var(--white);
  border: 1px solid #cbd4d0;
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
}
.composer {
  margin: 10px 16px 4px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 8px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: end;
  box-shadow: 0 8px 28px rgb(17 24 39 / 8%);
}
.composer textarea {
  border: 0;
  box-shadow: none;
  resize: none;
  padding: 10px 4px;
  max-height: 130px;
}
.composer textarea:focus {
  box-shadow: none;
}
.composer button {
  padding: 10px 15px;
}
.upload {
  width: 42px;
  height: 42px;
  margin: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--green);
  background: var(--green-soft);
  cursor: pointer;
  font-size: 24px;
}
.upload input {
  display: none;
}
.chat > .error {
  margin: 0 22px 8px;
}

@media (max-width: 640px) {
  .shell {
    border: 0;
  }
  header {
    height: 62px;
    padding: 0 16px;
  }
  .auth-card {
    margin: 4vh auto;
    padding: 28px 20px;
  }
  .chat {
    height: calc(100dvh - 62px);
  }
  .messages {
    padding-inline: 14px;
  }
  .composer {
    margin-inline: 10px;
  }
  .message {
    max-width: 90%;
  }
  .telegram-chip {
    width: 100%;
    justify-content: center;
    text-align: center;
  }
}
