:root {
  --black: #000000;
  --navy: #315da8;
  --muted: #474e58;
  --paper: #f0ece6;
  --white: #ffffff;
  --line: #dce7fb;
  --lime: #67d7f0;
  --lime-dark: #528bf6;
  --purple: #8b5cf6;
  --panel-gradient: linear-gradient(135deg, #528bf6 0%, #8b5cf6 58%, #67d7f0 125%);
  --shadow: 0 22px 70px rgba(82, 139, 246, 0.13);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--black);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

.topbar {
  width: min(1440px, calc(100% - 48px));
  height: 76px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(82, 139, 246, .2);
}

.brand {
  color: var(--black);
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 500;
  text-decoration: none;
  letter-spacing: -.02em;
}

.brand-mark {
  width: 25px;
  height: 32px;
  object-fit: contain;
}

.brand-name {
  font-size: 1rem;
}

.brand-collaboration {
  color: var(--muted);
  font-size: .9rem;
  font-weight: 500;
}

.brand-regenold {
  width: 105px;
  height: 24px;
  object-fit: contain;
}

.brand-product {
  margin-left: 3px;
  padding-left: 12px;
  border-left: 1px solid var(--line);
  /*color: var(--muted);*/
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0;
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.topbar-meta form,
.document-nav form {
  margin: 0;
}

.logout-link {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: .75rem;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.document-nav {
  display: flex;
  align-items: center;
  gap: 18px;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.login-shell {
  width: min(520px, calc(100% - 32px));
  margin: 40px auto;
}

.login-card {
  margin-top: 28px;
  padding: 38px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.login-card h1 {
  margin: 16px 0 12px;
  font-size: clamp(2.2rem, 8vw, 3.5rem);
}

.login-card p {
  margin: 0 0 25px;
  color: var(--muted);
}

.login-card form {
  display: grid;
  gap: 10px;
}

.login-card label {
  font-size: .78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.login-card input {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: white;
  color: var(--black);
}

.login-card .notice {
  margin-top: 18px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--lime-dark);
  box-shadow: 0 0 0 4px rgba(82, 139, 246, .18);
}

main {
  width: min(1440px, calc(100% - 48px));
  margin: 0 auto;
}

.hero {
  padding: 62px 0 38px;
  max-width: 780px;
}

.eyebrow,
.panel-kicker,
.section-label {
  color: var(--muted);
  font-size: .74rem;
  font-weight: 600;
  /*text-transform: uppercase;*/
  letter-spacing: .13em;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
}

.eyebrow span {
  width: 27px;
  height: 3px;
  background: var(--lime-dark);
}

h1 {
  margin: 18px 0 20px;
  font-size: clamp(2.7rem, 5vw, 5rem);
  line-height: .98;
  letter-spacing: -.065em;
}

h1 em {
  color: var(--purple);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
}

.hero p {
  max-width: 680px;
  margin: 0;
  color: var(--muted);
  font-size: 1.12rem;
}

.search-shell {
  background: var(--panel-gradient);
  padding: 16px;
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.search-box {
  min-height: 94px;
  display: grid;
  grid-template-columns: 24px 1fr auto;
  gap: 14px;
  align-items: start;
  background: var(--white);
  padding: 21px 22px;
  border-radius: 14px;
}

.search-icon {
  width: 17px;
  height: 17px;
  border: 2px solid var(--black);
  border-radius: 50%;
  position: relative;
  margin-top: 4px;
}

.search-icon::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 2px;
  right: -6px;
  bottom: -3px;
  background: var(--black);
  transform: rotate(45deg);
}

textarea {
  width: 100%;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--black);
  font-size: 1.17rem;
  line-height: 1.5;
}

textarea::placeholder {
  color: #9b9faa;
}

.shortcut {
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 3px 7px;
  font-size: .68rem;
  font-weight: 700;
}

.search-actions {
  padding: 14px 4px 0;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}

.search-settings {
  display: flex;
  gap: 12px;
}

.search-settings label {
  display: grid;
  gap: 4px;
  color: rgba(255, 255, 255, .78);
  font-size: .65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.search-settings select,
.search-settings input {
  height: 35px;
  min-width: 135px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, .34);
  border-radius: 8px;
  background: rgba(255, 255, 255, .5);
  color: white;
  outline: 0;
}

.button-row {
  display: flex;
  gap: 9px;
}

.button {
  border-radius: 10px;
  border: 1px solid transparent;
  padding: 11px 17px;
  font-weight: 800;
  transition: transform .15s, background .15s;
}

.button:hover {
  transform: translateY(-1px);
}

.button:disabled {
  opacity: .55;
  cursor: wait;
  transform: none;
}

.button-primary {
  background: var(--white);
  color: var(--black);
}

.button-primary:hover {
  background: #eef7ff;
}

.button-secondary {
  background: transparent;
  color: white;
  border-color: rgba(255, 255, 255, .5);
}

.spark {
  color: var(--purple);
}

.workspace {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 30px;
  padding: 36px 0 72px;
  align-items: start;
}

.filters-panel {
  position: sticky;
  top: 20px;
  border-top: 2px solid var(--black);
  padding-top: 14px;
}

.filter-heading {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--black);
  font-weight: 800;
}

.sliders {
  display: inline-block;
  width: 14px;
  height: 10px;
  border-top: 2px solid;
  border-bottom: 2px solid;
  margin-right: 7px;
  position: relative;
}

.sliders::after {
  content: "";
  position: absolute;
  width: 14px;
  border-top: 2px solid;
  top: 3px;
  left: 0;
}

.filter-count {
  width: 23px;
  height: 23px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--lime);
  font-size: .7rem;
}

.filter-group {
  margin-bottom: 18px;
}

.filter-group label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: .68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.filter-group select,
.filter-group input {
  width: 100%;
  height: 39px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  color: var(--black);
  padding: 0 9px;
  outline-color: var(--purple);
}

.date-grid {
  display: grid;
  gap: 7px;
}

.clear-filters {
  border: 0;
  padding: 0 0 3px;
  background: transparent;
  color: var(--black);
  font-size: .78rem;
  font-weight: 800;
  border-bottom: 1px solid var(--black);
}

.content-column {
  min-width: 0;
}

.answer-panel {
  background: var(--panel-gradient);
  color: white;
  border-radius: 20px;
  padding: clamp(22px, 4vw, 42px);
  margin-bottom: 30px;
  box-shadow: var(--shadow);
}

.panel-kicker {
  color: rgba(255, 255, 255, .78);
  margin-bottom: 20px;
}

.panel-kicker .spark {
  margin-right: 6px;
}

#answer-model {
  margin-right: 8px;
  padding-right: 9px;
  border-right: 1px solid rgba(255, 255, 255, .36);
  color: var(--white);
}

.answer-text {
  max-width: 900px;
  font-size: 1.04rem;
  line-height: 1.75;
}

.answer-text> :first-child {
  margin-top: 0;
}

.answer-text> :last-child {
  margin-bottom: 0;
}

.answer-text h1,
.answer-text h2,
.answer-text h3,
.answer-text h4 {
  color: white;
  line-height: 1.25;
}

.answer-text h1,
.answer-text h2 {
  margin: 1.25em 0 .55em;
  font-size: 1.35rem;
}

.answer-text h3,
.answer-text h4 {
  margin: 1.15em 0 .45em;
  font-size: 1.1rem;
}

.answer-text p,
.answer-text ul,
.answer-text ol,
.answer-text blockquote {
  margin: .75em 0;
}

.answer-text a:not(.inline-citation) {
  color: var(--white);
}

.answer-text code {
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(49, 93, 168, .35);
}

.answer-text blockquote {
  margin-left: 0;
  padding-left: 16px;
  border-left: 3px solid var(--lime);
  color: rgba(255, 255, 255, .82);
}

.inline-citation {
  display: inline-block;
  border-radius: 4px;
  padding: 1px 5px;
  margin: 0 2px;
  background: var(--white);
  color: var(--black);
  font-size: .7rem;
  font-weight: 900;
  line-height: 1.45;
  text-decoration: none;
  vertical-align: 2px;
}

.citation-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, .28);
}

.citation-chip {
  border: 1px solid rgba(255, 255, 255, .34);
  border-radius: 999px;
  background: rgba(255, 255, 255, .13);
  color: white;
  padding: 6px 10px;
  font-size: .72rem;
}

.results-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 2px solid var(--black);
  padding-bottom: 14px;
}

h2 {
  margin: 5px 0 0;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  letter-spacing: -.045em;
}

.results-mode {
  color: var(--muted);
  font-size: .75rem;
  font-weight: 700;
}

.notice {
  margin-top: 18px;
  padding: 24px;
  border: 1px dashed #b8bcaf;
  border-radius: 13px;
  color: var(--muted);
  background: rgba(255, 254, 250, .45);
}

.notice strong {
  display: block;
  color: var(--black);
  margin-bottom: 4px;
}

.notice.error {
  border-color: #d98674;
  color: #8f3726;
  background: #fff5f0;
}

.results-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 22px;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 800;
}

.pagination-top {
  justify-content: center;
  margin-top: 12px;
  margin-bottom: 2px;
}

.pagination-bottom {
  margin-top: 22px;
}

.pagination-status {
  min-width: 120px;
  text-align: center;
}

.pagination-button {
  min-width: 92px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  background: var(--white);
  color: var(--navy);
  font-size: .78rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.pagination-button:hover:not(:disabled) {
  border-color: var(--purple);
  color: var(--purple);
}

.pagination-button:disabled {
  opacity: .42;
  cursor: not-allowed;
}

.pagination-button.loading {
  opacity: 1;
  cursor: wait;
}

.pagination-button.loading::before {
  content: "";
  width: 12px;
  height: 12px;
  border: 2px solid rgba(82, 139, 246, .25);
  border-top-color: var(--lime-dark);
  border-radius: 999px;
  animation: pagination-spin .75s linear infinite;
}

@keyframes pagination-spin {
  to {
    transform: rotate(360deg);
  }
}

.result-card {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  gap: 16px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--white);
  transition: border-color .2s, transform .2s, box-shadow .2s;
}

.result-card:hover,
.result-card.active {
  border-color: var(--purple);
  transform: translateY(-1px);
  box-shadow: 0 10px 32px rgba(82, 139, 246, .13);
}

.source-badge {
  min-width: 43px;
  width: fit-content;
  height: 43px;
  padding: 0 8px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--panel-gradient);
  color: white;
  font-size: .72rem;
  font-weight: 900;
}

.result-title {
  margin: 0;
  font-size: 1rem;
  line-height: 1.35;
}

.result-heading {
  color: var(--purple);
  font-size: .78rem;
  font-weight: 800;
  margin-top: 3px;
}

.result-snippet {
  color: var(--muted);
  margin: 10px 0 12px;
  font-size: .86rem;
  line-height: 1.58;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: pre-line;
}

.result-snippet mark,
.result-heading mark {
  padding: 1px 2px;
  border-radius: 3px;
  background: var(--lime);
  color: var(--black);
}

.result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  padding: 3px 7px;
  background: #eef4ff;
  border-radius: 5px;
  color: var(--muted);
  font-size: .64rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.source-link {
  color: var(--black);
  align-self: start;
  font-size: .75rem;
  font-weight: 800;
  text-decoration: none;
  border-bottom: 1px solid;
  white-space: nowrap;
}

.back-link {
  color: var(--black);
  font-size: .78rem;
  font-weight: 800;
  text-decoration: none;
  border-bottom: 1px solid;
}

.document-shell {
  padding: 58px 0 90px;
  max-width: 1180px;
}

.document-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 35px;
  padding-bottom: 30px;
  border-bottom: 2px solid var(--black);
}

.document-header h1 {
  max-width: 850px;
  margin: 16px 0 22px;
  font-size: clamp(2rem, 4vw, 3.8rem);
  line-height: 1.04;
}

.document-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 190px;
}

.document-actions a {
  text-align: center;
  text-decoration: none;
  font-size: .78rem;
}

.document-secondary {
  border-color: var(--black);
  color: var(--black);
  background: transparent;
}

.button.disabled {
  opacity: .45;
  pointer-events: none;
}

.markdown-body {
  margin: 32px auto 0;
  padding: clamp(25px, 6vw, 76px);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow-wrap: anywhere;
}

.markdown-body> :first-child {
  margin-top: 0;
}

.markdown-body h1 {
  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: 1.05;
  letter-spacing: -.055em;
}

.markdown-body h2 {
  margin-top: 2.2em;
  padding-bottom: .35em;
  border-bottom: 2px solid var(--black);
  font-size: clamp(1.4rem, 3vw, 2.2rem);
}

.markdown-body h3 {
  margin-top: 1.8em;
  color: var(--purple);
  font-size: 1.25rem;
}

.markdown-body h4 {
  margin-top: 1.5em;
}

.markdown-body p,
.markdown-body li {
  color: #41516c;
  line-height: 1.72;
}

.markdown-body a {
  color: var(--purple);
}

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: .84rem;
}

.markdown-body th,
.markdown-body td {
  padding: 10px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.markdown-body th {
  background: var(--panel-gradient);
  color: white;
}

.markdown-body blockquote {
  margin-left: 0;
  padding: 5px 20px;
  border-left: 4px solid var(--lime-dark);
  color: var(--muted);
}

.markdown-body code {
  background: #eef4ff;
  border-radius: 4px;
  padding: 2px 5px;
}

.hidden {
  display: none;
}

footer {
  width: min(1440px, calc(100% - 48px));
  margin: 0 auto;
  padding: 25px 0 35px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 20px;
  font-size: .72rem;
}

@media (max-width: 850px) {

  .topbar,
  main,
  footer {
    width: min(100% - 28px, 1440px);
  }

  .topbar-meta {
    display: none;
  }

  .hero {
    padding-top: 48px;
  }

  h1 {
    letter-spacing: -.06em;
  }

  .search-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .search-settings,
  .button-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .search-settings select,
  .search-settings input {
    width: 100%;
  }

  .workspace {
    grid-template-columns: 1fr;
    gap: 20px;
    padding-top: 22px;
  }

  .filters-panel {
    position: static;
  }

  #filter-content {
    display: none;
    grid-template-columns: 1fr 1fr;
    gap: 0 12px;
  }

  .filters-panel.open #filter-content {
    display: grid;
  }

  .result-card {
    grid-template-columns: 45px minmax(0, 1fr);
  }

  .source-link {
    grid-column: 2;
    justify-self: start;
  }

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

  .document-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  footer {
    flex-direction: column;
  }
}

@media (max-width: 540px) {
  .brand-name {
    display: none;
  }

  .brand-regenold {
    width: 92px;
  }

  .brand-product {
    padding-left: 9px;
    font-size: .7rem;
  }

  .hero p {
    font-size: .96rem;
  }

  .shortcut {
    display: none;
  }

  .search-box {
    grid-template-columns: 22px 1fr;
  }

  .search-settings,
  .button-row,
  #filter-content {
    grid-template-columns: 1fr;
  }

  .button {
    width: 100%;
  }

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

  .pagination,
  .pagination-top {
    justify-content: center;
    flex-wrap: wrap;
  }

  .result-card {
    padding: 15px;
    gap: 11px;
  }

  .document-actions {
    grid-template-columns: 1fr;
  }

  .markdown-body {
    padding: 20px;
    border-radius: 12px;
  }
}
