:root {
  --ink: #181614;
  --muted: #6e6863;
  --taupe: #b58c75;
  --taupe-dark: #8f6955;
  --taupe-soft: #f4ece7;
  --paper: #ffffff;
  --border: #e8e2de;
  --shadow: 0 24px 70px rgba(50, 38, 31, 0.09);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, rgba(181, 140, 117, 0.09), transparent 26rem),
    var(--paper);
  font-family: "Poppins", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

.page-shell {
  width: min(100% - 40px, 900px);
  margin: 0 auto;
  padding: 72px 0 88px;
}

.page-header {
  max-width: 690px;
  margin: 0 auto 42px;
  text-align: center;
}

.brand-mark {
  display: grid;
  width: 46px;
  height: 46px;
  margin: 0 auto 18px;
  place-items: center;
  border: 1px solid rgba(181, 140, 117, 0.55);
  border-radius: 50%;
  color: var(--taupe-dark);
  background: rgba(255, 255, 255, 0.78);
  font-family: "Playfair Display", Georgia, serif;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.eyebrow,
.section-label {
  margin: 0 0 10px;
  color: var(--taupe-dark);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(42px, 7vw, 64px);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.tagline {
  margin: 16px 0 0;
  font-size: clamp(17px, 2vw, 20px);
  font-weight: 500;
}

.intro {
  max-width: 620px;
  margin: 14px auto 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.8;
}

.chat-card {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.chat-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 26px 30px 18px;
}

.chat-card__top h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.section-label {
  margin-bottom: 5px;
}

.connection-badge {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border-radius: 999px;
  color: #765f52;
  background: var(--taupe-soft);
  font-size: 11px;
  font-weight: 500;
}

.connection-badge__dot {
  width: 7px;
  height: 7px;
  border: 1px solid var(--taupe);
  border-radius: 50%;
  background: var(--paper);
}

.document-status {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  margin: 0 30px 24px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  list-style: none;
}

.document-status li {
  display: flex;
  min-width: 0;
  padding: 13px 14px;
  flex-direction: column;
  gap: 3px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
}

.document-status li + li {
  border-left: 1px solid var(--border);
}

.status-value {
  color: var(--muted);
  font-size: 10px;
  font-weight: 400;
}

.chat-area {
  height: min(44vh, 410px);
  min-height: 340px;
  padding: 30px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: #fcfbfa;
  scroll-behavior: smooth;
}

.message {
  display: flex;
  margin-bottom: 22px;
  flex-direction: column;
  align-items: flex-start;
}

.message:last-child {
  margin-bottom: 0;
}

.message--user {
  align-items: flex-end;
}

.message__label {
  margin: 0 10px 7px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.message__bubble {
  max-width: min(100%, 630px);
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: 6px 18px 18px;
  background: var(--paper);
  font-size: 13px;
  line-height: 1.72;
  box-shadow: 0 6px 22px rgba(50, 38, 31, 0.04);
}

.message__bubble p {
  margin: 0 0 12px;
}

.message__bubble p:last-child {
  margin-bottom: 0;
}

.message--user .message__bubble {
  max-width: min(85%, 560px);
  border-color: var(--taupe);
  border-radius: 18px 6px 18px 18px;
  color: var(--paper);
  background: var(--taupe);
  overflow-wrap: anywhere;
}

.message-form {
  display: flex;
  gap: 12px;
  padding: 22px 30px 8px;
}

.message-form input {
  width: 100%;
  min-width: 0;
  height: 52px;
  padding: 0 18px;
  border: 1px solid var(--border);
  border-radius: 13px;
  outline: none;
  color: var(--ink);
  background: var(--paper);
  font-size: 13px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.message-form input::placeholder {
  color: #9b9590;
}

.message-form input:focus {
  border-color: var(--taupe);
  box-shadow: 0 0 0 4px rgba(181, 140, 117, 0.14);
}

.message-form button {
  min-width: 104px;
  height: 52px;
  padding: 0 24px;
  border: 1px solid var(--taupe);
  border-radius: 13px;
  color: var(--paper);
  background: var(--taupe);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.message-form button:hover {
  border-color: var(--taupe-dark);
  background: var(--taupe-dark);
}

.message-form button:active {
  transform: translateY(1px);
}

.message-form button:focus-visible {
  outline: 3px solid rgba(181, 140, 117, 0.35);
  outline-offset: 3px;
}

.form-note {
  margin: 0;
  padding: 0 31px 20px;
  color: #97908b;
  font-size: 10px;
}

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

@media (max-width: 700px) {
  .page-shell {
    width: min(100% - 28px, 900px);
    padding: 44px 0 50px;
  }

  .page-header {
    margin-bottom: 30px;
  }

  .chat-card {
    border-radius: 19px;
  }

  .chat-card__top {
    padding: 22px 20px 16px;
  }

  .document-status {
    grid-template-columns: repeat(2, 1fr);
    margin: 0 20px 20px;
  }

  .document-status li:nth-child(3),
  .document-status li:nth-child(4) {
    border-top: 1px solid var(--border);
  }

  .document-status li:nth-child(3) {
    border-left: 0;
  }

  .chat-area {
    height: 48vh;
    min-height: 390px;
    padding: 22px 20px;
  }

  .message-form {
    padding: 18px 20px 8px;
  }

  .form-note {
    padding: 0 21px 17px;
  }
}

@media (max-width: 440px) {
  .page-shell {
    width: min(100% - 20px, 900px);
    padding-top: 32px;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
    margin-bottom: 14px;
  }

  .connection-badge {
    padding: 7px 9px;
  }

  .message__bubble {
    padding: 15px 16px;
  }

  .message-form {
    gap: 8px;
  }

  .message-form input,
  .message-form button {
    height: 48px;
  }

  .message-form button {
    min-width: 76px;
    padding: 0 16px;
  }
}

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