﻿:root {
  color-scheme: light;
  --bg: #f8edf4;
  --bg-top: #fff4f9;
  --bg-deep: #efe6ee;
  --paper: rgba(255, 255, 255, 0.58);
  --paper-strong: rgba(255, 255, 255, 0.84);
  --ink: #1b1b22;
  --muted: #6e6b74;
  --line: rgba(209, 177, 194, 0.5);
  --divider: #c9c0c7;
  --accent: #ff7aa6;
  --accent-strong: #d14579;
  --accent-soft: rgba(255, 122, 166, 0.14);
  --user-bubble: #f3d5e3;
  --assistant-bubble: rgba(255, 255, 255, 0.95);
  --shadow: 0 24px 80px rgba(103, 63, 84, 0.14);
  --mono: "IBM Plex Mono", monospace;
  --sans: "DM Sans", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, #ffe6f1 0%, transparent 42%),
    radial-gradient(circle at 88% 18%, #f6d7e7 0%, transparent 46%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg) 55%, var(--bg-deep) 100%);
}

button,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  height: 100vh;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  overflow: hidden;
}

.history-rail {
  position: relative;
  min-height: 0;
  padding: 20px 14px 18px;
  background:
    radial-gradient(circle at 12% 8%, #ffe6f1 0%, transparent 42%),
    radial-gradient(circle at 88% 18%, #f6d7e7 0%, transparent 46%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg) 55%, var(--bg-deep) 100%);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: hidden;
}

.history-rail::after {
  content: "";
  position: absolute;
  top: 0;
  right: -2px;
  width: 2px;
  height: 100%;
  background: var(--divider);
}

.history-rail__top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  flex: 1;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0;
  background: transparent;
  color: inherit;
}

.brand-mark__icon-shell {
  display: block;
  width: 60px;
  height: 42px;
  overflow: hidden;
  flex: 0 0 auto;
}

.brand-mark__icon {
  display: block;
  height: 100%;
  width: auto;
}

.brand-mark__wordmark {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
}

.brand-mark__wordmark-image {
  display: block;
  height: 24px;
  width: auto;
}

.new-chat {
  padding: 10px 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #fff7fb;
  font-weight: 700;
  box-shadow: 0 12px 30px rgba(209, 69, 121, 0.18);
}

.history-search-shell {
  padding-right: 4px;
}

.history-search {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid rgba(209, 177, 194, 0.64);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.58);
}

.history-search::placeholder {
  color: #8d6e7d;
}

.history-search:focus {
  outline: 2px solid rgba(255, 122, 166, 0.18);
  outline-offset: 2px;
}

.eyebrow {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.72;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

.history-list__empty {
  margin: 8px 2px 0;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.32);
  border: 1px solid rgba(255, 255, 255, 0.42);
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.history-item {
  text-align: left;
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  min-height: 52px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.34);
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.48);
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
  box-shadow: 0 10px 24px rgba(103, 63, 84, 0.05);
}

.history-item:hover,
.history-item--active {
  transform: translateX(2px);
  background: rgba(255, 255, 255, 0.56);
  border-color: rgba(209, 69, 121, 0.22);
}

.history-item__title {
  font-size: 0.94rem;
  font-weight: 700;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item__time {
  font-size: 0.76rem;
  color: var(--muted);
  font-family: var(--mono);
}

.chat-stage {
  min-height: 0;
  height: 100vh;
  padding: 10px 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
}

.chat-stage__fixed-context {
  margin: 12px 0 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 12px 28px rgba(108, 73, 92, 0.08);
  color: #7b4961;
  font-size: 0.9rem;
  font-weight: 700;
}

.thread-frame {
  flex: 1;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  overflow: hidden;
}

.thread-scroll {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px 0 10px;
}

.thread-empty {
  max-width: 640px;
  margin: 12vh auto 0;
  padding: 0 28px;
  text-align: center;
}

.thread-empty__label {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.thread-empty__hint {
  margin: 12px auto 0;
  max-width: 560px;
  color: var(--muted);
  line-height: 1.7;
}

.thread-messages {
  width: min(1160px, calc(100% - 28px));
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding-bottom: 18px;
}

.message {
  display: grid;
  gap: 8px;
  animation: message-in 0.24s ease;
}

.message__label,
.message__meta {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
  font-family: var(--mono);
}

.message__bubble {
  white-space: pre-wrap;
  line-height: 1.65;
  padding: 18px 20px;
  border-radius: 22px;
  max-width: min(720px, 100%);
  box-shadow: 0 16px 40px rgba(103, 63, 84, 0.09);
}

.message--assistant .message__bubble {
  background: var(--assistant-bubble);
  border-top-left-radius: 10px;
}

.message--verification .message__bubble {
  width: 100%;
  max-width: none;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

.verification-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.97) 0%, rgba(255, 247, 251, 0.92) 100%);
  border: 1px solid rgba(209, 177, 194, 0.52);
  box-shadow: 0 22px 60px rgba(109, 69, 91, 0.12);
}

.verification-card__hero {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.verification-card__title {
  margin: 0;
  font-size: clamp(1.12rem, 1.8vw, 1.38rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.verification-card__subline {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.verification-card__status {
  padding: 8px 11px;
  border-radius: 999px;
  background: rgba(255, 122, 166, 0.12);
  color: var(--accent-strong);
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  white-space: nowrap;
}

.verification-card__status[data-status="covered"] {
  background: rgba(68, 166, 115, 0.14);
  color: #2b7d53;
}

.verification-card__status[data-status="not-covered"],
.verification-card__status[data-status="not-found"] {
  background: rgba(194, 82, 109, 0.12);
  color: #ab3f5d;
}

.verification-card__facts,
.verification-card__metrics,
.verification-card__services {
  display: grid;
  gap: 8px;
}

.verification-card__facts {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.verification-card__metrics {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.verification-card__services {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.verification-card__fact,
.verification-card__metric {
  min-width: 0;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(228, 203, 215, 0.82);
}

.verification-card__fact-label,
.verification-card__metric-label,
.verification-card__section-title {
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.verification-card__fact-value {
  margin: 5px 0 0;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.28;
  word-break: break-word;
}

.verification-card__section {
  display: grid;
  gap: 6px;
}

.verification-card__metric-value {
  margin: 5px 0 0;
  font-size: 0.94rem;
  font-weight: 800;
  line-height: 1.22;
  letter-spacing: -0.02em;
}

.verification-card__metric-detail {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.32;
}

.message--user {
  justify-items: end;
}

.message--user .message__bubble {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #fff7fb;
  font-weight: 600;
  border-top-right-radius: 10px;
}

.message--optimistic .message__bubble {
  opacity: 0.74;
}

.thread-error {
  width: min(1160px, calc(100% - 28px));
  margin: 0 auto 10px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(221, 47, 88, 0.09);
  border: 1px solid rgba(221, 47, 88, 0.16);
  color: #8d2441;
  font-weight: 600;
}

.composer {
  width: min(1160px, calc(100% - 28px));
  margin: 0 auto;
  padding: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
}

.composer__input {
  resize: none;
  min-height: 64px;
  max-height: 220px;
  overflow-y: auto;
  padding: 16px 18px;
  border-radius: 20px;
  border: 1px solid rgba(209, 177, 194, 0.6);
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.64);
}

.composer__input:focus {
  outline: 2px solid rgba(255, 122, 166, 0.22);
  outline-offset: 2px;
}

.composer__send {
  align-self: end;
  padding: 0 24px;
  min-height: 64px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #fff7fb;
  font-weight: 800;
  letter-spacing: -0.01em;
  box-shadow: 0 20px 42px rgba(209, 69, 121, 0.24);
}

.composer__send:disabled,
.composer__input:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.mobile-backdrop {
  display: none;
}

@keyframes message-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .history-rail {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(86vw, 320px);
    transform: translateX(-104%);
    transition: transform 0.22s ease;
    z-index: 20;
    box-shadow: 28px 0 80px rgba(77, 38, 58, 0.18);
  }

  .history-rail::after {
    display: none;
  }

  .app-shell[data-sidebar-open="true"] .history-rail {
    transform: translateX(0);
  }

  .mobile-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(49, 24, 37, 0.36);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
    display: block;
    z-index: 18;
  }

  .app-shell[data-sidebar-open="true"] + .mobile-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .chat-stage {
    padding: 8px 14px 14px;
  }

  .verification-card__services {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .composer {
    padding-left: 16px;
    padding-right: 16px;
  }

  .thread-messages {
    width: calc(100% - 10px);
  }

  .thread-error,
  .composer {
    width: calc(100% - 10px);
  }

  .composer {
    grid-template-columns: 1fr;
  }

  .composer__send {
    min-height: 54px;
  }

  .verification-card {
    padding: 14px;
    gap: 12px;
  }

  .verification-card__hero {
    flex-direction: column;
    align-items: stretch;
  }

  .verification-card__facts,
  .verification-card__metrics,
  .verification-card__services {
    grid-template-columns: 1fr;
  }
}
