:root {
  color-scheme: light;
  --bg: #f7f9f6;
  --ink: #252525;
  --muted: #767771;
  --line: #dedfda;
  --panel: #ffffff;
  --blue: #1f67ad;
  --blue-dark: #0c437d;
  --blue-soft: #e4f0fb;
  --green: #0f7659;
  --green-dark: #0a5f47;
  --green-soft: #eaf4df;
  --warn: #b45309;
  --shadow: 0 16px 36px rgba(33, 48, 61, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  gap: 22px;
  min-height: 100vh;
  padding: 22px;
}

.sidebar,
.chat-area {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 12px 30px rgba(34, 48, 68, 0.04);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 24px 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.compact-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  border-radius: 11px;
  background: var(--green);
  color: white;
  font-size: 20px;
  font-weight: 800;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.brand h1 {
  color: var(--green);
  font-size: 20px;
  line-height: 1.1;
  font-weight: 800;
}

.brand p {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.2;
}

.new-chat {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 12px;
  background: var(--green);
  color: white;
  font-size: 18px;
  font-weight: 800;
}

.new-chat span {
  font-size: 26px;
  line-height: 1;
  font-weight: 400;
}

.compare-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid var(--blue);
  border-radius: 12px;
  color: var(--blue);
  background: var(--blue-soft);
  font-weight: 800;
  text-decoration: none;
}

.compare-link:hover {
  background: var(--blue);
  color: white;
}

.free-link {
  border-color: var(--green);
  color: var(--green);
  background: var(--green-soft);
}

.free-link:hover {
  background: var(--green);
  color: white;
}

.drop-zone {
  display: grid;
  gap: 6px;
  border: 1px dashed #a9b7a5;
  border-radius: 12px;
  background: #fbfdf9;
  color: var(--green);
  padding: 14px;
  text-align: center;
}

.drop-zone.dragging {
  border-color: var(--green);
  background: var(--green-soft);
}

.drop-zone input {
  display: none;
}

.drop-zone strong {
  font-size: 15px;
}

.drop-zone span,
.upload-status {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.sidebar-section {
  display: grid;
  gap: 14px;
}

.sidebar-section h2,
.eyebrow {
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.section-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ghost-icon {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.ghost-icon:hover {
  background: #f0f2ed;
  color: var(--green);
}

.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.stats div {
  border-radius: 12px;
  padding: 12px 14px;
}

.stat-files {
  background: var(--green-soft);
  color: #2f6b14;
}

.stat-chunks {
  background: var(--blue-soft);
  color: var(--blue-dark);
}

dt {
  font-size: 15px;
}

dd {
  margin: 0 0 4px;
  font-size: 28px;
  line-height: 1;
  font-weight: 800;
}

.sources {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.source-chip {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  border: 0;
  border-left: 4px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  padding: 9px 12px;
  text-align: left;
}

.source-chip span:last-child {
  overflow-wrap: anywhere;
}

.source-chip.active {
  border-left-color: var(--green);
  background: #f2f5f2;
}

.doc-icon {
  color: var(--green);
  font-size: 13px;
  font-weight: 900;
}

.prompts {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.prompts button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  color: #161616;
  text-align: left;
  padding: 10px 14px;
}

.prompts button:hover {
  border-color: var(--green);
  background: #fbfdf9;
}

.question-bank-section {
  min-height: 0;
}

.small-count {
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}

.question-filter {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  padding: 9px 11px;
  outline: none;
}

.question-filter:focus {
  border-color: var(--green);
}

.question-bank {
  display: grid;
  gap: 8px;
  max-height: 300px;
  overflow: auto;
  padding-right: 2px;
}

.question-item {
  display: grid;
  gap: 4px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  color: var(--ink);
  padding: 10px;
  text-align: left;
}

.question-item:hover {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.question-item span {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
}

.question-item small {
  color: var(--muted);
  font-size: 11px;
}

.chat-area {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 96px;
  padding: 22px 44px;
  border-bottom: 1px solid var(--line);
}

.topbar h2 {
  margin-top: 5px;
  color: var(--blue-dark);
  font-size: 30px;
  line-height: 1.1;
  font-weight: 800;
}

.ready-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border-radius: 999px;
  background: var(--green-soft);
  color: #285d11;
  padding: 9px 15px;
  font-size: 18px;
  font-weight: 700;
  white-space: nowrap;
}

.ready-pill span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #5c9a16;
}

.ready-pill.warn {
  background: #fff7ed;
  color: var(--warn);
}

.ready-pill.warn span {
  background: var(--warn);
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 24px;
  overflow-y: auto;
  padding: 36px 44px;
}

.message {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  max-width: 920px;
}

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

.avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--green);
  color: white;
  font-size: 16px;
  font-weight: 800;
}

.message.user .avatar {
  background: var(--blue);
}

.bubble {
  max-width: min(760px, calc(100vw - 500px));
  border: 1px solid var(--line);
  border-radius: 14px 14px 14px 4px;
  background: white;
  padding: 17px 20px;
  color: #3c3c3c;
  font-size: 18px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.message.user .bubble {
  border-color: var(--blue);
  border-radius: 14px 14px 4px 14px;
  background: var(--blue);
  color: white;
}

.citation-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.answer {
  display: grid;
  gap: 10px;
}

.answer p,
.answer ul,
.answer h3,
.answer h4 {
  margin: 0;
}

.answer ul {
  padding-left: 22px;
}

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

.answer h3,
.answer h4 {
  color: var(--blue-dark);
  font-size: 18px;
  line-height: 1.25;
}

.cite-ref {
  display: inline;
  border: 0;
  background: transparent;
  color: var(--blue);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  padding: 0 1px;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.answer-meta {
  border: 1px solid #cfe0c6;
  border-radius: 10px;
  background: var(--green-soft);
  color: var(--green-dark);
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 800;
}

.answer-meta.warn {
  border-color: #fed7aa;
  background: #fff7ed;
  color: var(--warn);
}

.compare-cache-notice {
  grid-column: 1 / -1;
  border: 1px solid #cfe0c6;
  border-radius: 10px;
  background: var(--green-soft);
  color: var(--green-dark);
  padding: 10px 12px;
  font-weight: 800;
}

.citation {
  border: 1px solid #d8e4ef;
  border-left: 4px solid var(--green);
  border-radius: 10px;
  background: #fbfdff;
  padding: 11px;
  cursor: pointer;
}

.citation strong {
  color: var(--blue-dark);
}

.citation p {
  margin-top: 5px;
  color: #536173;
  font-size: 13px;
}

.citation:hover {
  border-color: var(--green);
  background: #f8fcf6;
}

.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 26, 34, 0.48);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(760px, calc(100vw - 32px));
  max-height: min(760px, calc(100vh - 48px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.22);
  padding: 24px;
}

.modal-card h2 {
  margin-top: 6px;
  color: var(--blue-dark);
  font-size: 24px;
}

.modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--green);
  padding: 7px 12px;
  font-weight: 800;
}

.modal-location {
  margin-top: 8px;
  color: var(--muted);
  font-weight: 700;
}

.modal-text {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfcfb;
  padding: 16px;
  color: #333;
  line-height: 1.55;
  white-space: pre-wrap;
}

.typing-dots {
  display: inline-flex;
  gap: 4px;
  margin-right: 10px;
  vertical-align: middle;
}

.typing-dots i {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #44b892;
  animation: typingPulse 1.1s infinite ease-in-out;
}

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

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

@keyframes typingPulse {
  0%,
  80%,
  100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-4px);
  }
}

.composer {
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  padding: 20px 44px 24px;
}

.input-wrap {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fbfcfb;
  padding: 7px 8px 7px 16px;
}

.input-icon {
  color: var(--muted);
  font-size: 18px;
  font-weight: 800;
}

textarea {
  width: 100%;
  min-height: 42px;
  max-height: 120px;
  resize: none;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 10px 0;
  outline: none;
  line-height: 1.4;
  font-size: 18px;
}

textarea::placeholder {
  color: #858782;
}

.composer button {
  min-width: 104px;
  height: 42px;
  border: 0;
  border-radius: 12px;
  background: var(--green);
  color: white;
  font-weight: 800;
}

.composer button span {
  margin-left: 6px;
  font-weight: 900;
}

.composer button:hover {
  background: var(--green-dark);
}

.composer button:disabled {
  cursor: progress;
  opacity: 0.65;
}

.composer-hint {
  margin-top: 12px;
  color: var(--muted);
  font-size: 14px;
}

kbd {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7f6f2;
  padding: 2px 8px;
}

code {
  border-radius: 5px;
  background: var(--green-soft);
  color: var(--green-dark);
  padding: 2px 5px;
}

.compare-shell {
  min-height: 100vh;
  padding: 24px;
}

.compare-header,
.compare-intro,
.compare-form,
.compare-grid,
.compare-citations {
  width: min(1480px, 100%);
  margin: 0 auto;
}

.compare-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}

.compare-header .mark {
  display: grid;
  align-content: center;
  width: 102px;
  height: 64px;
  border-radius: 4px;
  background: white;
  color: var(--blue);
  line-height: 0.9;
  box-shadow: inset 0 -4px 0 var(--green), 0 8px 22px rgba(39, 88, 137, 0.12);
  padding: 9px 10px;
}

.compare-header .mark span {
  color: var(--green);
  font-weight: 800;
  font-size: 14px;
}

.compare-header .mark strong {
  display: block;
  color: var(--green);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 24px;
  font-weight: 700;
}

.compare-header .mark em {
  display: block;
  color: var(--blue);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 23px;
  font-style: normal;
}

.compare-nav {
  display: flex;
  align-items: center;
  gap: 14px;
}

.compare-nav a {
  color: var(--blue);
  font-weight: 800;
  text-decoration: none;
}

.compare-intro {
  margin-top: 22px;
  border-radius: 12px;
  padding: 32px;
  background: linear-gradient(90deg, var(--blue-dark), var(--blue));
  color: white;
}

.compare-intro h2 {
  max-width: 760px;
  font-size: 36px;
  line-height: 1.12;
}

.compare-intro p {
  margin-top: 10px;
  max-width: 680px;
  font-size: 17px;
}

.compare-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 118px;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  padding: 14px;
}

.question-strip {
  width: min(1480px, 100%);
  margin: 18px auto 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  padding: 14px;
}

.question-strip h2 {
  color: var(--muted);
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.question-bank.horizontal {
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  max-height: 220px;
  margin-top: 12px;
}

.compare-form textarea {
  min-height: 64px;
  max-height: 180px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
}

.compare-form button {
  height: 52px;
  border: 0;
  border-radius: 999px;
  background: var(--blue);
  color: white;
  cursor: pointer;
  font-weight: 800;
}

.compare-form button:disabled {
  cursor: progress;
  opacity: 0.65;
}

.compare-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.compare-grid.two-up {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.compare-card {
  min-height: 340px;
  max-height: 720px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 12px 28px rgba(36, 64, 92, 0.08);
  padding: 18px;
}

.compare-card .answer {
  font-size: 16px;
  line-height: 1.55;
}

.model-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
  padding-bottom: 12px;
}

.model-head h3 {
  margin: 3px 0 0;
  color: var(--blue);
  overflow-wrap: anywhere;
}

.model-cost {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.model-head span {
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green-dark);
  padding: 6px 9px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.error-card {
  border-color: #fed7aa;
  background: #fff7ed;
}

.muted {
  color: var(--muted);
}

.compare-citations {
  margin-top: 18px;
}

@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .sidebar {
    gap: 18px;
  }

  .topbar,
  .messages,
  .composer {
    padding-left: 18px;
    padding-right: 18px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .bubble {
    max-width: calc(100vw - 104px);
  }

  .compare-grid {
    grid-template-columns: 1fr;
  }

  .compare-header,
  .compare-form {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .compare-intro {
    padding: 24px 18px;
  }

  .compare-intro h2 {
    font-size: 28px;
  }
}
