:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --border: #dbe4f0;
  --text: #172033;
  --muted: #6b778c;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eff6ff;
  --user-bg: #2563eb;
  --assistant-bg: #ffffff;
  --danger: #b91c1c;
  --success: #15803d;
  --shadow:
    0 18px 60px
    rgba(15, 23, 42, 0.1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background:
    linear-gradient(
      180deg,
      #f8fbff 0%,
      var(--bg) 100%
    );
  color: var(--text);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  line-height: 1.55;
}

button,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

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

.app-shell {
  width: min(920px, 100%);
  margin: 0 auto;
  padding: 24px 14px;
}

.assistant-card {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.assistant-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  background: #ffffff;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 12px;
  background:
    linear-gradient(
      135deg,
      var(--primary),
      #6d5dfc
    );
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 900;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-copy strong {
  font-size: 0.96rem;
}

.brand-copy small {
  color: var(--muted);
  font-size: 0.76rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-pill {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  padding: 0 10px;
  border-radius: 999px;
  background: #ecfdf3;
  color: var(--success);
  font-size: 0.73rem;
  font-weight: 800;
}

.status-pill.thinking {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.status-pill.error {
  background: #fef2f2;
  color: var(--danger);
}

.icon-button {
  min-height: 36px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #ffffff;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
}

.hero {
  padding: 28px 20px 18px;
  text-align: center;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--primary);
  font-size: 0.71rem;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.hero h1 {
  margin: 0 0 9px;
  font-size:
    clamp(
      1.8rem,
      5vw,
      2.8rem
    );
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.hero p:last-child {
  max-width: 690px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 0.94rem;
}

.suggestion-panel {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding: 0 18px 20px;
}

.suggestion-chip {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid #cbd8ea;
  border-radius: 999px;
  background: #ffffff;
  color: #344054;
  font-size: 0.75rem;
  font-weight: 700;
}

.suggestion-chip:hover {
  border-color: var(--primary);
  color: var(--primary-dark);
}

.chat-log {
  display: flex;
  min-height: 390px;
  max-height: 590px;
  flex-direction: column;
  gap: 20px;
  padding: 24px 22px;
  overflow-y: auto;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--surface-soft);
}

.message {
  display: flex;
  width: 100%;
}

.message-content {
  width: min(760px, 100%);
}

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

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

.message-label {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.user-message .message-label {
  text-align: right;
}

.message-bubble {
  padding: 15px 17px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--assistant-bg);
  color: var(--text);
  overflow-wrap: anywhere;
}

.user-message .message-bubble {
  border-color: var(--user-bg);
  background: var(--user-bg);
  color: #ffffff;
}

.message-bubble p {
  margin: 0;
}

.message-bubble p + p {
  margin-top: 11px;
}

.message-bubble h2,
.message-bubble h3,
.message-bubble h4 {
  margin:
    18px 0 8px;
  color: var(--text);
  line-height: 1.25;
}

.message-bubble h2:first-child,
.message-bubble h3:first-child,
.message-bubble h4:first-child {
  margin-top: 0;
}

.message-bubble h2 {
  font-size: 1.22rem;
}

.message-bubble h3 {
  font-size: 1.08rem;
}

.message-bubble h4 {
  font-size: 0.98rem;
}

.message-bubble ul,
.message-bubble ol {
  margin: 10px 0 0;
  padding-left: 22px;
}

.message-bubble li + li {
  margin-top: 6px;
}

.message-bubble strong {
  font-weight: 800;
}

.message-bubble code {
  padding:
    2px 6px;
  border-radius: 6px;
  background: #eef2f7;
  color: #24324a;
  font-family:
    ui-monospace,
    SFMono-Regular,
    Menlo,
    Consolas,
    monospace;
  font-size: 0.86em;
}

.message-bubble a {
  color: var(--primary-dark);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.user-message .message-bubble a {
  color: #ffffff;
}

.message-footer {
  display: flex;
  margin-top: 7px;
}

.copy-button {
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--muted);
  font-size: 0.69rem;
  font-weight: 800;
}

.sources {
  display: grid;
  gap: 7px;
  margin-top: 10px;
}

.sources-title {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
}

.source-links {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.source-link {
  display: inline-flex;
  min-height: 31px;
  align-items: center;
  padding: 0 10px;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 0.7rem;
  font-weight: 800;
  text-decoration: none;
}

.typing-bubble {
  width: 74px;
}

.typing-dots {
  display: inline-flex;
  gap: 5px;
}

.typing-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  animation:
    typing-pulse
    1.15s
    infinite
    ease-in-out;
}

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

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

@keyframes typing-pulse {
  0%,
  80%,
  100% {
    opacity: 0.28;
    transform: scale(0.8);
  }

  40% {
    opacity: 1;
    transform: scale(1);
  }
}

.chat-composer {
  display: grid;
  grid-template-columns:
    minmax(0, 1fr)
    auto;
  gap: 10px;
  padding: 14px;
  background: #ffffff;
}

.chat-composer textarea {
  width: 100%;
  min-height: 50px;
  max-height: 150px;
  padding: 13px 14px;
  resize: none;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: #ffffff;
  color: var(--text);
  outline: none;
  line-height: 1.45;
}

.chat-composer textarea:focus {
  border-color: var(--primary);
  box-shadow:
    0 0 0 3px
    rgba(37, 99, 235, 0.11);
}

.send-button {
  min-width: 90px;
  border: 0;
  border-radius: 13px;
  background:
    linear-gradient(
      135deg,
      var(--primary),
      #4f46e5
    );
  color: #ffffff;
  font-weight: 800;
}

.send-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.assistant-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px 16px;
  color: var(--muted);
  font-size: 0.71rem;
}

.assistant-footer p {
  margin: 0;
}

.assistant-footer a {
  color: var(--primary-dark);
  font-weight: 800;
  text-decoration: none;
}

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

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

  .assistant-header {
    padding: 13px 14px;
  }

  .status-pill {
    display: none;
  }

  .hero {
    padding:
      24px
      15px
      16px;
  }

  .suggestion-panel {
    justify-content: flex-start;
    flex-wrap: nowrap;
    padding:
      0
      12px
      16px;
    overflow-x: auto;
  }

  .suggestion-chip {
    flex: 0 0 auto;
  }

  .chat-log {
    min-height: 54vh;
    max-height: none;
    padding:
      18px
      12px;
  }

  .message-content {
    width: 100%;
  }

  .user-message .message-content {
    width: 88%;
  }

  .message-bubble {
    padding:
      13px
      14px;
  }

  .chat-composer {
    position: sticky;
    bottom: 0;
    z-index: 10;
    grid-template-columns:
      1fr;
    padding: 11px;
    border-top:
      1px solid
      var(--border);
  }

  .send-button {
    min-height: 44px;
  }

  .assistant-footer {
    align-items:
      flex-start;
    flex-direction:
      column;
    padding:
      11px
      13px
      17px;
  }
}
