:root {
  color-scheme: light;
  font-family: Arial, sans-serif;
  color: #252520;
  background: #f4f3ef;
  font-size: 16px;
  line-height: 1.45;
  --ink: #252520;
  --muted: #656158;
  --line: #e5e2d8;
  --surface: #fff;
  --quiet: #f8f7f3;
  --accent: #f1cc52;
  --focus: #79600b;
  --ease: cubic-bezier(.2, .75, .25, 1);
}

* { box-sizing: border-box; }
body, h1, h2, h3, p, pre { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button, select { cursor: pointer; }
[hidden] { display: none !important; }
::selection { color: var(--ink); background: #f5de86; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }

.symbols {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  display: block;
  flex: none;
  width: 1.125rem;
  height: 1.125rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sr-only, .skip-link:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link:focus {
  position: fixed;
  z-index: 1;
  inset: 1rem auto auto 1rem;
  padding: .75rem 1rem;
  border-radius: .5rem;
  background: var(--surface);
  color: var(--ink);
}

.shell { width: min(calc(100% - 4rem), 76rem); margin-inline: auto; }

.topbar {
  color: #faf9f3;
  background: #22221f;
  border-bottom: 1px solid #35342c;
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
  min-height: 7.5rem;
  padding-block: 1.25rem;
}

.title-group, .topbar-actions {
  display: flex;
  align-items: center;
  gap: .875rem;
}

.title-icon {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border-radius: .75rem;
  background: var(--accent);
  color: #292415;
}

.title-icon .icon { width: 1.5rem; height: 1.5rem; }

h1 {
  font-family: Montserrat, Arial, sans-serif;
  font-size: clamp(1.625rem, 3.1vw, 2.125rem);
  font-weight: 720;
  letter-spacing: -.036em;
  line-height: 1.13;
}

.overview {
  margin-top: .375rem;
  color: #d4d0c4;
  font-size: .875rem;
  font-variant-numeric: tabular-nums;
}

.demo-badge {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem .75rem;
  border: 1px solid #625333;
  border-radius: .5rem;
  background: #332e22;
  color: #f3dfa6;
  font-size: .8125rem;
  white-space: nowrap;
}

.demo-badge::before, .status::before {
  content: "";
  flex: none;
  width: .4375rem;
  height: .4375rem;
  border-radius: 50%;
  background: currentColor;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-height: 2.75rem;
  padding: .5rem .75rem;
  border: 1px solid transparent;
  border-radius: .5rem;
  background: transparent;
  font-size: .875rem;
  font-weight: 650;
  transition: background-color .16s var(--ease), border-color .16s var(--ease);
}

.button:disabled, .button[aria-disabled="true"] { cursor: wait; opacity: .72; }

.header-button {
  background: #33332e;
  color: #faf9f3;
  border-color: #56554a;
}

.header-button:hover:not([aria-disabled="true"]) { background: #424138; }
.header-button:focus-visible { outline-color: #f1cc52; }
.header-button[aria-disabled="true"] .icon { animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.panel-message {
  margin-block: 1rem;
  color: var(--muted);
  font-size: .875rem;
}

.login { padding-block: clamp(1.5rem, 5vw, 4rem); }

.login-card {
  width: min(100%, 27rem);
  margin-inline: auto;
  padding: clamp(1.25rem, 4vw, 2rem);
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--surface);
  box-shadow: 0 2px 5px #29251a08;
}

.login-card h2 {
  font-size: 1.5rem;
  letter-spacing: -.025em;
  line-height: 1.2;
}

#login-form { display: grid; gap: 1rem; margin-top: 1.25rem; }

.login-field { display: grid; gap: .375rem; font-weight: 650; }

.login-field input {
  width: 100%;
  min-height: 2.75rem;
  padding: .5rem .75rem;
  border: 1px solid #a8a397;
  border-radius: .5rem;
  background: var(--surface);
  font-size: 1rem;
  font-weight: 400;
}

.remember-browser {
  display: flex;
  align-items: flex-start;
  gap: .625rem;
  min-height: 2.75rem;
  padding-block: .25rem;
  cursor: pointer;
}

.remember-browser input {
  flex: none;
  width: 1.125rem;
  height: 1.125rem;
  margin: .1875rem 0 0;
  accent-color: var(--focus);
}

#remember-hint { display: block; color: var(--muted); font-size: .875rem; }
#login-message { margin: 0; }
.login-submit { background: var(--accent); color: #292415; }
.login-submit:hover:not(:disabled) { background: #e9bd37; }

.registry {
  display: grid;
  grid-template-columns: minmax(19rem, .91fr) minmax(0, 2.22fr);
  align-items: start;
  gap: 1.25rem;
  padding-block: 1.5rem 3rem;
}

.index, .detail, .detail-empty {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--surface);
  box-shadow: 0 2px 5px #29251a08;
}

.index-header { padding: 1.25rem 1.125rem .875rem; }
.index-header h2 { margin-bottom: .875rem; font-size: 1.125rem; letter-spacing: -.015em; }

.search-control {
  display: flex;
  align-items: center;
  gap: .5rem;
  min-height: 2.75rem;
  padding-inline: .75rem;
  border: 1px solid #d4d0c3;
  border-radius: .625rem;
  background: var(--quiet);
  color: var(--muted);
}

.search-control:focus-within {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  background: var(--surface);
}

#search {
  width: 100%;
  min-width: 0;
  min-height: 2.625rem;
  padding: .375rem 0;
  border: 0;
  outline: none;
  color: var(--ink);
  background: transparent;
  caret-color: var(--focus);
  font-size: .9375rem;
}

#search::placeholder { color: var(--muted); opacity: 1; }

.filters {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: .125rem;
  margin-top: .75rem;
  padding: .1875rem;
  border: 1px solid var(--line);
  border-radius: .625rem;
  background: var(--quiet);
}

.filters button {
  min-height: 2.75rem;
  padding: .375rem .5rem;
  border: 1px solid transparent;
  border-radius: .4375rem;
  background: transparent;
  color: #59564f;
  font-size: .8125rem;
  font-weight: 600;
  white-space: nowrap;
}

.filters button:hover { color: var(--ink); background: #eeece4; }

.filters button[aria-pressed="true"] {
  color: #342b14;
  background: #f9eabc;
  border-color: #e7d393;
}

.list-message {
  padding: .375rem 1.125rem 1rem;
  color: var(--muted);
  font-size: .875rem;
}
.list-message:empty { display: none; }
.list-message.error { color: #9a362b; }

.audit-list, .files { list-style: none; margin: 0; padding: 0; }

.audit-list {
  max-height: 32rem;
  overflow: auto;
  padding: 0 .625rem .625rem;
  scrollbar-color: #bbb6a7 transparent;
}
.audit-list:empty { padding: 0; }
.audit-list li + li { margin-top: .125rem; }

.audit {
  display: grid;
  width: 100%;
  gap: .375rem;
  padding: .75rem .625rem;
  border: 1px solid transparent;
  border-radius: .625rem;
  color: var(--ink);
  background: transparent;
  text-align: start;
}

.audit:hover { background: var(--quiet); }
.audit:focus-visible { outline-offset: -2px; }
.audit[aria-current="true"] { border-color: #e3ce8b; background: #fcf3d9; }
.audit-title {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-size: .9375rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.audit-site { color: var(--muted); font-size: .8125rem; overflow-wrap: anywhere; }

.audit-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .25rem .625rem;
}

.audit-date, .created { color: var(--muted); font-size: .8125rem; font-variant-numeric: tabular-nums; }

.status {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  padding: .1875rem .5rem;
  border-radius: .375rem;
  font-size: .75rem;
  line-height: 1.4;
  font-weight: 650;
}

.status[data-state="ready"] { color: #305943; background: #edf3ed; }
.status[data-state="pending"] { color: #70501d; background: #f4ecdc; }

.detail { padding: 1.75rem 2rem 2rem; }
.detail-header { padding-bottom: 1.25rem; border-bottom: 1px solid var(--line); }
.back-to-list { display: none; }

.detail-title, .section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem 1rem;
}

.detail-title h2 {
  min-width: 0;
  font-size: clamp(1.375rem, 3.1vw, 1.875rem);
  font-weight: 720;
  line-height: 1.16;
  letter-spacing: -.035em;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  scroll-margin-top: .75rem;
}

.detail-title .status { padding: .3125rem .625rem; }
.detail-site { margin-top: .375rem; color: var(--muted); font-size: .875rem; overflow-wrap: anywhere; }

.created {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .375rem;
  margin-top: .5rem;
}
.created .icon { width: 1rem; height: 1rem; }

.documents, .prompt-section, .chat-section { margin-top: 1.375rem; }
.section-heading h3 { font-size: 1.0625rem; letter-spacing: -.012em; }

.versions {
  display: flex;
  align-items: center;
  gap: .5rem;
  color: var(--muted);
  font-size: .8125rem;
}

.select-control { position: relative; display: inline-flex; }
.select-control .icon {
  position: absolute;
  top: 50%;
  right: .625rem;
  width: .9375rem;
  height: .9375rem;
  transform: translateY(-50%);
  pointer-events: none;
}

.versions select {
  appearance: none;
  max-width: 100%;
  min-height: 2.625rem;
  padding: .375rem 2rem .375rem .625rem;
  border: 1px solid #d4d0c3;
  border-radius: .5rem;
  background: var(--surface);
  color: var(--ink);
}

.section-message { margin-top: .625rem; color: var(--muted); font-size: .875rem; }
.section-message.error { color: #9a362b; }

.files:not(:empty) {
  margin-top: .625rem;
  border: 1px solid var(--line);
  border-radius: .75rem;
  overflow: hidden;
}

.files li + li { border-top: 1px solid var(--line); }

.file {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: .875rem;
  min-height: 4.25rem;
  padding: .75rem;
  color: var(--ink);
  text-decoration: none;
  transition: background-color .16s var(--ease);
}

.file:hover, .file:focus-visible { background: var(--quiet); }
.file:focus-visible { outline-offset: -3px; }

.file-type {
  display: grid;
  place-items: center;
  width: 3.125rem;
  height: 2.5rem;
  border-radius: .5rem;
  background: #eeece5;
  color: #554e3d;
  font-size: .6875rem;
  font-weight: 750;
  letter-spacing: .03em;
}

.file-type[data-type="DOCX"] { background: #e9eef5; color: #375375; }
.file-type[data-type="PPTX"] { background: #f6ebe3; color: #834735; }
.file-type[data-type="PDF"] { background: #f7eae9; color: #873b37; }
.file-type[data-type="XLSX"] { background: #e8f0e9; color: #355e45; }

.file-content { display: grid; gap: .125rem; }
.file-name { font-size: .9375rem; font-weight: 650; overflow-wrap: anywhere; }
.file-size { color: var(--muted); font-size: .8125rem; font-variant-numeric: tabular-nums; }

.file-action {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  color: #674d12;
  font-size: .8125rem;
  font-weight: 650;
}
.file:hover .file-action span { text-decoration: underline; text-underline-offset: .2em; }

.file[aria-busy="true"] { cursor: wait; }

.quiet-button {
  border-color: var(--line);
  background: var(--surface);
  color: #5a513d;
}
.quiet-button:hover { background: #f5f2e9; border-color: #dad2b8; }

.prompt-text {
  max-height: 17.5rem;
  margin-top: .625rem;
  overflow: hidden;
  padding: 1rem 1.125rem;
  border: 1px solid var(--line);
  border-radius: .75rem;
  background: var(--quiet);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: inherit;
  font-size: .9375rem;
  line-height: 1.68;
}

.prompt-text.expanded { max-height: none; }
.expand-prompt { margin-top: .5rem; }
.expand-prompt[aria-expanded="true"] .icon { transform: rotate(180deg); }

.chat-messages {
  margin: .75rem 0 0;
  padding: 0;
  list-style: none;
}
.chat-messages:empty { margin-top: 0; }
.chat-message {
  border-top: 1px solid var(--line);
  padding: .875rem 0;
}
.chat-role { margin-bottom: .25rem; color: var(--muted); font-size: .8125rem; font-weight: 700; }
.chat-message[data-role="user"] .chat-role { color: #674d12; }
.chat-text { max-width: 75ch; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.show-more-messages { margin-top: .25rem; }

.detail-empty {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: .75rem;
  min-height: 15rem;
  padding: 2rem;
  color: var(--muted);
  text-align: center;
  font-size: .9375rem;
}

.detail-empty .icon { width: 1.5rem; height: 1.5rem; }

@media (max-width: 47.5rem) {
  .shell { width: calc(100% - 1.5rem); }
  .topbar-inner { min-height: 0; flex-wrap: wrap; padding-block: 1rem; }
  .title-group, .topbar-actions { gap: .625rem; }
  .title-icon { width: 2.375rem; height: 2.375rem; }
  .title-icon .icon { width: 1.25rem; height: 1.25rem; }
  .topbar-actions { flex-wrap: wrap; }
  .registry { grid-template-columns: minmax(0, 1fr); gap: .75rem; padding-block: .75rem 2rem; }
  .registry:not(.show-audit) .detail, .registry.show-audit .index { display: none; }
  .index-header { padding: 1rem .875rem .75rem; }
  .audit-list { max-height: none; }
  .detail { padding: 1rem; }
  .back-to-list { display: inline-flex; margin: -.375rem 0 .375rem -.5rem; padding-inline: .375rem .625rem; }
  .detail-header { padding-bottom: 1rem; }
  .file { min-height: 3.875rem; gap: .625rem; }
  .file-action span { display: none; }
  .prompt-text { max-height: 13rem; padding: .875rem; }
  .detail-empty { display: none; }
}

@media (max-width: 23rem) {
  .file-type { width: 2.5rem; }
  .file { gap: .4375rem; padding-inline: .5rem; }
  .filters button { padding-inline: .25rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
