/*
  OneNote notebook chrome.
  Brand purple #7719AA, deep rail #5C2D91, page white on a lavender desk.
*/

:root {
  --on-purple: #a5b4fc;
  --on-purple-dark: #818cf8;
  --on-purple-deep: #e0e7ff;
  --on-purple-soft: rgba(129, 140, 248, 0.16);
  --on-purple-mid: rgba(129, 140, 248, 0.28);
  --ask: #4f46e5;
  --ink: #e7e9f2;
  --muted: #a8b0c4;
  --line: rgba(255, 255, 255, 0.12);
  --desk: #0e1018;
  --page: #171a26;
  --card: #1e2233;
  --sidebar: #12141c;
  --bar: #12141c;
  --bar-ink: #e7e9f2;
  --error-bg: rgba(239, 68, 68, 0.14);
  --error-border: #f87171;
  --error-text: #fecaca;
  --font-sans: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 8px;
}

[data-theme="light"] {
  --on-purple: #7719aa;
  --on-purple-dark: #5c2d91;
  --on-purple-deep: #3b1259;
  --on-purple-soft: #f6effb;
  --on-purple-mid: #efe4f7;
  --ask: #7719aa;
  --ink: #323130;
  --muted: #605e5c;
  --line: #e1dfdd;
  --desk: #e7e1ee;
  --page: #ffffff;
  --card: #faf8fc;
  --sidebar: #f4f1f8;
  --bar: #5c2d91;
  --bar-ink: #ffffff;
  --error-bg: #fde7e9;
  --error-border: #a80000;
  --error-text: #a4262c;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--desk);
  display: flex;
  flex-direction: row;
  min-height: 100vh;
  height: 100vh;
  overflow: hidden;
}

.app-shell {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* KaTeX's default hide is clip:rect on an absolute MathML copy. That clip
   stops working when an ancestor scrolls (the display-math rule below),
   and the equation then paints twice, citation included. */
.katex .katex-mathml {
  display: none;
}

.appbar {
  background: var(--bar);
  color: var(--bar-ink);
  display: flex;
  align-items: center;
  position: relative;
  padding: 0.35rem 0.9rem;
  flex-shrink: 0;
  border-bottom: 1px solid var(--line);
}

.appbar__brand,
.appbar__meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  flex: 1;
  overflow: visible;
}

.appbar__titles {
  min-width: 0;
  overflow: hidden;
}

.appbar__tools {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: auto;
  flex-shrink: 0;
}

.appbar__product {
  margin: 0;
  font-size: 0.75rem;
  opacity: 0.85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 16rem;
}

.appbar__titles h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.appbar__logo {
  height: 40px;
  width: auto;
  display: block;
  background: transparent;
  padding: 0;
  object-fit: contain;
  flex-shrink: 0;
}

.appbar__meta p {
  margin: 0;
  font-size: 0.82rem;
}

.appbar__status {
  opacity: 0.85;
  font-size: 0.75rem;
}

.desk {
  flex: 1;
  min-height: 0;
  display: flex;
  padding: 0.85rem 1rem 16px;
}

.notebook {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  max-width: 920px;
  margin: 0 auto;
  width: 100%;
}

.notebook__page {
  flex: 1;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--page);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
  border: 1px solid var(--line);
  overflow: hidden;
}

.transcript {
  flex: 1;
  min-height: 0;
  min-width: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 1.25rem 1.25rem 0.5rem;
}

.bubble--user {
  align-self: flex-end;
  max-width: min(85%, 34rem);
  background: var(--ask);
  color: #ffffff;
  border-radius: 12px 12px 4px 12px;
  padding: 0.65rem 0.9rem;
}

.bubble--user p {
  margin: 0;
  line-height: 1.45;
}

.bubble--bot {
  align-self: stretch;
}

.welcome {
  align-self: center;
  width: 100%;
  min-width: 0;
  max-width: 40rem;
  margin: auto 0;
  padding: 0.5rem 0 1rem;
  background: transparent;
  border: 0;
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
}

.welcome__hero {
  text-align: center;
  width: 100%;
  max-width: 100%;
  padding: 0 0.75rem;
  box-sizing: border-box;
}

.welcome__title {
  margin: 0 0 0.3rem;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.35;
}

.welcome__lead {
  margin: 0 auto;
  max-width: min(32rem, 100%);
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.welcome[hidden] {
  display: none !important;
}

.suggestions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.suggestion {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.05rem;
  width: 100%;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 400;
  border-radius: 6px;
  padding: 0.55rem 0.7rem;
  text-align: left;
  cursor: pointer;
}

.suggestion__id {
  font-size: 0.75rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--on-purple-dark);
  line-height: 1.3;
}

.suggestion__label {
  display: block;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
}

.suggestion__question {
  display: block;
  font-size: 0.78rem;
  font-weight: 400;
  line-height: 1.35;
  color: var(--muted);
}

.suggestion:hover {
  background: var(--on-purple-mid);
}

.suggestion:focus-visible,
#ask-button:focus-visible,
.source-card summary:focus-visible {
  outline: 2px solid var(--on-purple);
  outline-offset: 2px;
}

.composer {
  padding: 0.75rem 1.25rem 16px;
  background: var(--page);
  border-top: 1px solid var(--line);
}

.thinking {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 0.65rem;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 600;
}

.thinking[hidden] {
  display: none !important;
}

.math-palette {
  display: grid;
  gap: 0.4rem;
  margin-bottom: 0.55rem;
  min-width: 0;
  padding: 2px 1px 0;
}

.math-palette[hidden] {
  display: none !important;
}

.math-keyboard-toggle {
  margin-bottom: 0.45rem;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--card);
  color: var(--on-purple-deep);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}

.math-keyboard-toggle[aria-expanded="true"] {
  border-color: var(--on-purple);
  background: var(--on-purple-soft);
}

.math-palette__categories,
.math-palette__keys {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.math-category {
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.72rem;
  cursor: pointer;
}

.math-category[aria-pressed="true"] {
  border-color: var(--on-purple);
  background: var(--on-purple-soft);
  color: var(--on-purple);
  font-weight: 600;
}

.math-palette__keys[hidden] {
  display: none !important;
}

.math-key {
  min-width: 2.35rem;
  min-height: 2.2rem;
  padding: 0.25rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  flex-shrink: 0;
}

.math-key:hover:not(:disabled) {
  border-color: var(--on-purple);
  background: var(--on-purple-soft);
}

.math-key:focus-visible {
  outline: 2px solid var(--on-purple);
  outline-offset: 2px;
}

.math-category:focus-visible {
  outline: 2px solid var(--on-purple);
  outline-offset: 2px;
}

.math-key:disabled {
  opacity: 0.55;
  cursor: default;
}

#ask-form {
  display: flex;
  align-items: flex-end;
  gap: 0.6rem;
}

textarea#question {
  flex: 1;
  width: 100%;
  min-width: 0;
  font: inherit;
  font-size: 1rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  resize: none;
  min-height: 2.75rem;
  max-height: 8rem;
  overflow-y: auto;
  line-height: 1.4;
  background: var(--desk);
  color: var(--ink);
}

textarea#question:focus {
  outline: 2px solid var(--on-purple);
  outline-offset: 1px;
  border-color: var(--on-purple);
}

#ask-button {
  background: var(--ask);
  color: #ffffff;
  border: none;
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.7rem 1.15rem;
  border-radius: var(--radius);
  cursor: pointer;
  flex-shrink: 0;
}

#ask-button:hover:not(:disabled) {
  background: var(--on-purple-dark);
}

#ask-button:disabled {
  opacity: 0.55;
  cursor: default;
}

.composer__hint {
  margin: 0.4rem 0 0;
  font-size: 0.75rem;
  color: var(--muted);
}

.result__loading {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--muted);
  padding: 0.4rem 0;
}

.spinner {
  width: 1.05rem;
  height: 1.05rem;
  border: 2px solid var(--on-purple-mid);
  border-top-color: var(--on-purple);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.result__error {
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  color: var(--error-text);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
}

.result__error .retry {
  margin-top: 0.6rem;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--error-border);
  border-radius: var(--radius);
  padding: 0.35rem 0.7rem;
  cursor: pointer;
}

.access-gate {
  max-width: 28rem;
  margin: 2rem auto;
  padding: 1.25rem;
  background: var(--page);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.access-gate label,
.access-gate h2 {
  display: block;
  margin-bottom: 0.5rem;
}

.access-gate input {
  width: 100%;
  margin-bottom: 0.75rem;
  padding: 0.5rem;
  font: inherit;
  color: var(--ink);
  background: var(--desk);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.access-gate__error {
  color: var(--error-text);
  min-height: 1.2rem;
}

.answer-card {
  position: relative;
  border: 1px solid var(--line);
  border-left: 4px solid var(--on-purple);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem 1rem;
  background: var(--page);
}

.answer-card__body h2 {
  margin: 0 0 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--line);
  color: var(--on-purple-deep);
  font-size: 1rem;
  font-weight: 700;
}

.answer-card__body h2:not(:first-child) {
  margin-top: 1.35rem;
}

.answer-card__body h3 {
  margin: 1.1rem 0 0.45rem;
  color: var(--on-purple-dark);
  font-size: 0.95rem;
}

.answer-card__body hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 1.2rem 0;
}

.answer-card__body ul,
.answer-card__body ol {
  margin: 0.2rem 0 0.85rem;
  padding-left: 1.4rem;
}

.answer-card__body li:not(.source-card) {
  margin: 0.3rem 0;
  line-height: 1.65;
}

.answer-card__body p {
  margin: 0 0 0.75rem;
  line-height: 1.65;
}

.answer-card__body p:last-child {
  margin-bottom: 0;
}

.answer-card p.math-display,
.answer-card .katex-display {
  margin: 0.85rem 0;
  text-align: center;
  overflow-x: auto;
  overflow-y: hidden;
}

.answer-card__body table {
  border-collapse: collapse;
  margin: 0.4rem 0 0.9rem;
  font-size: 0.92rem;
  display: block;
  overflow-x: auto;
}

.answer-card__body th,
.answer-card__body td {
  border: 1px solid var(--line);
  padding: 0.3rem 0.65rem;
  text-align: center;
}

.answer-card__body th {
  background: var(--on-purple-soft);
  color: var(--on-purple-deep);
}

.answer-card .katex {
  font-size: 1.08em;
  color: var(--ink);
}

.answer-card__copy {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 6px;
  padding: 0.2rem 0.55rem;
  cursor: pointer;
}

.answer-card__copy:hover {
  background: var(--on-purple-soft);
}

/* Keep the first heading clear of the Copy button. */
.answer-card__body > :first-child {
  padding-right: 4.5rem;
}

.result__stopped {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-style: italic;
}

#ask-button.is-stop {
  background: var(--card);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
}

#ask-button.is-stop:hover {
  background: var(--on-purple-soft);
}

.appbar__button,
.appbar__icon {
  border: 1px solid color-mix(in srgb, var(--bar-ink) 35%, transparent);
  background: transparent;
  color: var(--bar-ink);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
}

.appbar__button {
  padding: 0.3rem 0.7rem;
}

.appbar__icon {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
}

.appbar__icon[aria-expanded="true"] {
  background: color-mix(in srgb, var(--bar-ink) 14%, transparent);
}

.appbar__icon svg[hidden] {
  display: none;
}

.menu {
  position: relative;
}

.more-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 11rem;
  background: var(--page);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  padding: 0.35rem;
  z-index: 30;
}

.more-menu[hidden] {
  display: none !important;
}

.more-menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  color: var(--ink);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  padding: 0.55rem 0.7rem;
  border-radius: 6px;
  cursor: pointer;
}

.more-menu button:hover {
  background: var(--on-purple-soft);
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 15;
  border: 0;
  padding: 0;
  background: rgba(0, 0, 0, 0.45);
  cursor: pointer;
}

.sidebar-backdrop[hidden] {
  display: none !important;
}

.appbar__button:hover,
.appbar__icon:hover {
  background: rgba(255, 255, 255, 0.15);
}

.appbar__button[hidden] {
  display: none;
}

.answer-card--external {
  border-left-color: #eab308;
  background: var(--page);
}

.answer-card--external .answer-card__body h2 {
  color: var(--ink);
}

.retrieved {
  margin-top: 1.15rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
}

.retrieved h2 {
  margin: 0 0 0.55rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.retrieved__list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.retrieved__item {
  background: transparent;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  padding: 0.55rem 0 0.15rem;
}

.retrieved__item:first-child {
  border-top: 0;
  padding-top: 0;
}

.retrieved__item--main {
  background: rgba(255, 214, 10, 0.16);
  border-left: 4px solid #f2b200;
  border-radius: 6px;
  padding: 0.55rem 0.7rem 0.4rem;
}

.retrieved__item--main:first-child {
  padding-top: 0.55rem;
}

.retrieved__badge {
  display: inline-block;
  margin-bottom: 0.25rem;
  padding: 0.05rem 0.5rem;
  border-radius: 999px;
  background: #f2b200;
  color: #1c1500;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.retrieved__place {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.35;
}

.retrieved__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.75rem;
  margin: 0.1rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.retrieved__open {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ask);
  text-decoration: none;
}

.retrieved__open::after {
  content: " →";
}

.retrieved__open:hover {
  text-decoration: underline;
}

.retrieved__where {
  margin: 0.12rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.retrieved__details {
  margin-top: 0.35rem;
}

.retrieved__details summary {
  cursor: pointer;
  font-size: 0.78rem;
  color: var(--muted);
}

.retrieved__text {
  margin-top: 0.35rem;
  font-size: 0.84rem;
  line-height: 1.45;
  max-height: 14rem;
  overflow: auto;
}

.retrieved__text p {
  margin: 0.25rem 0;
}

.retrieved__text ul {
  margin: 0.25rem 0 0.25rem 1.1rem;
  padding: 0;
}

.slide__title {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  font-weight: 700;
}

.slide__row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.2rem;
  padding: 0.15rem 0;
  border-bottom: 1px solid var(--line);
}

.slide__cell:first-child {
  min-width: 2.5rem;
  font-weight: 600;
}

.sources {
  margin-top: 1.15rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
}

.sources h2 {
  margin: 0 0 0.7rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--on-purple-dark);
}

.source-section + .source-section {
  margin-top: 0.95rem;
}

.source-section h3 {
  margin: 0 0 0.45rem;
  font-size: 0.9rem;
  color: var(--on-purple-deep);
}

.source-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.source-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--ask);
  border-radius: 6px;
  color: var(--ink);
}

.source-card__head {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.45rem 0.7rem;
  min-width: 0;
}

.source-card summary {
  cursor: pointer;
  list-style: none;
}

.source-card summary::-webkit-details-marker {
  display: none;
}

.source-card summary::before {
  content: "\25B8";
  color: var(--on-purple);
  font-size: 0.8rem;
  transition: transform 0.15s;
}

.source-card details[open] summary::before {
  transform: rotate(90deg);
}

.source-card summary:hover {
  background: var(--on-purple-soft);
}

.source-card__place {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--on-purple-deep);
  white-space: nowrap;
}

.source-card__preview {
  font-size: 0.85rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.source-card__text {
  border-top: 1px solid var(--line);
  padding: 0.55rem 0.75rem 0.65rem;
  font-size: 0.86rem;
  line-height: 1.45;
  white-space: pre-wrap;
  max-height: 16rem;
  overflow-y: auto;
}

@media (max-width: 640px) {
  body {
    height: 100dvh;
  }

  .appbar {
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.5rem;
    padding: 0.35rem 0.65rem;
  }

  .appbar__brand {
    gap: 0.4rem;
  }

  .appbar__titles {
    flex: 1 1 0%;
  }

  .appbar__icon {
    width: 32px;
    height: 32px;
  }

  .appbar__logo {
    height: 28px;
    width: auto;
    max-width: 46px;
    min-width: 0;
    flex-shrink: 1;
    padding: 2px 3px;
    object-fit: contain;
  }

  .welcome__lead {
    width: 100%;
    font-size: 0.86rem;
    white-space: normal;
  }

  .appbar__titles h1 {
    font-size: 1rem;
  }

  .appbar,
  .app-shell {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .appbar__brand {
    padding-right: 0;
  }

  .composer,
  #ask-form,
  .suggestions,
  .suggestion,
  .welcome__hero,
  .welcome__lead {
    min-width: 0;
    max-width: 100%;
  }

  .appbar__brand {
    padding-right: 76px;
  }

  .appbar__tools {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 0;
  }

  .appbar__product {
    display: block;
    font-size: 0.68rem;
    max-width: 11rem;
  }

  .suggestions {
    grid-template-columns: 1fr;
  }

  .desk {
    padding: 0.45rem 0.45rem 16px;
  }

  .transcript,
  .composer {
    padding-left: 0.85rem;
    padding-right: 0.85rem;
  }

  #ask-form {
    flex-direction: column;
    align-items: stretch;
  }

  .source-card__preview {
    display: none;
  }
}

.sidebar {
  width: 280px;
  min-width: 280px;
  height: 100vh;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.sidebar-header h2 {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.new-chat-btn {
  width: 100%;
  padding: 10px 16px;
  background: var(--on-purple-soft);
  border: 1px solid var(--on-purple-mid);
  color: var(--on-purple-deep);
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.new-chat-btn:hover {
  background: var(--on-purple-mid);
}

.session-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.session-item {
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 2px;
  position: relative;
}

.session-item:hover,
.session-item.active {
  background: var(--on-purple-soft);
}

.session-title {
  font-size: 13px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0 28px 0 0;
}

.session-time {
  font-size: 11px;
  color: var(--muted);
  margin: 2px 0 0;
}

.session-item .delete-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  background: none;
  border: none;
  color: #fca5a5;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
}

.session-item:hover .delete-btn,
.session-item:focus-within .delete-btn {
  opacity: 1;
}

.header-stats {
  display: flex;
  gap: 1.25rem;
}

.stat {
  text-align: center;
}

.stat-value {
  display: block;
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
}

.stat-label {
  font-size: 0.65rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  opacity: 0.8;
}

.typing-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.85rem;
}

.typing-indicator .dots,
.thinking .dots {
  display: flex;
  gap: 4px;
}

.typing-indicator .dot,
.thinking .dot {
  width: 6px;
  height: 6px;
  background: var(--on-purple);
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out;
}

.typing-indicator .dot:nth-child(2),
.thinking .dot:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator .dot:nth-child(3),
.thinking .dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

.response-meta {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.answer-card__feedback {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.75rem;
  margin-top: 0.9rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}

.answer-card__feedback-label {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.feedback-buttons {
  display: flex;
  gap: 0.4rem;
  margin: 0;
}

.feedback-note {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.feedback-note:empty {
  display: none;
}

.badge,
.slide-link,
.slide-ref {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
}

.badge-source,
.slide-link,
.slide-ref {
  background: var(--on-purple-soft);
  color: var(--on-purple-deep);
  border: 1px solid var(--on-purple-mid);
}

.badge-abstention {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.badge-notes {
  background: rgba(34, 197, 94, 0.12);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.35);
}

.badge-time {
  background: rgba(148, 163, 184, 0.12);
  color: var(--muted);
  border: 1px solid var(--line);
}

.feedback-btn {
  padding: 0.28rem 0.7rem;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink);
}

.feedback-btn:disabled {
  cursor: default;
}

.feedback-btn.selected-good,
.feedback-btn.selected-bad {
  background: var(--on-purple-soft);
  border-color: var(--on-purple-mid);
  color: var(--on-purple-deep);
}

.feedback-dialog {
  width: min(420px, calc(100vw - 2rem));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--page);
  color: var(--ink);
  padding: 1.15rem 1.2rem 1rem;
}

.feedback-dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

.feedback-dialog h2 {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
}

.feedback-dialog__note {
  margin: 0 0 0.9rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.feedback-dialog label {
  display: block;
  margin: 0.7rem 0 0.3rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.feedback-dialog select,
.feedback-dialog textarea {
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  color: var(--ink);
  background: var(--desk);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.45rem 0.55rem;
}

.feedback-dialog__status {
  min-height: 1.2rem;
  margin: 0.6rem 0 0;
  font-size: 0.85rem;
}

.feedback-dialog__actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.7rem;
}

.feedback-dialog__actions button {
  font: inherit;
  font-weight: 600;
  border-radius: 6px;
  padding: 0.4rem 0.8rem;
  cursor: pointer;
}

.feedback-dialog__actions button[type="submit"] {
  background: var(--on-purple);
  color: #fff;
  border: 0;
}

.feedback-dialog__actions button[type="button"] {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.suggestions-title {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.sidebar-toggle {
  display: inline-flex;
}

@media (min-width: 901px) {
  .sidebar.is-collapsed {
    width: 0;
    min-width: 0;
    border-right: 0;
  }
}

@media (max-width: 900px) {
  .header-stats {
    display: none;
  }

  .sidebar {
    position: fixed;
    left: -280px;
    z-index: 20;
    transition: left 0.2s ease;
  }

  .sidebar.is-open {
    left: 0;
    box-shadow: 8px 0 24px rgba(0, 0, 0, 0.35);
  }
}

[data-theme="light"] .badge-notes {
  color: #166534;
}

[data-theme="light"] .badge-abstention {
  color: #a4262c;
}

[data-theme="light"] .stat-value {
  color: #fff;
}

.question-preview {
  margin-bottom: 0.45rem;
  padding: 0.45rem 0.7rem;
  border: 1px dashed var(--line);
  border-radius: 6px;
  background: var(--card);
  color: var(--ink);
  font-size: 1rem;
  overflow-x: auto;
}

.question-preview[hidden] {
  display: none !important;
}
