:root {
  color-scheme: light;
  --paper: oklch(99% 0.003 235);
  --surface: oklch(96% 0.006 235);
  --ink: oklch(27% 0.024 240);
  --muted: oklch(49% 0.025 240);
  --line: oklch(89% 0.012 235);
  --accent: oklch(48% 0.13 245);
  --focus: oklch(57% 0.15 245);
  --error: oklch(40% 0.16 25);
  font:
    14px / 1.45 -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    system-ui,
    sans-serif;
  color: var(--ink);
  background: var(--paper);
  --chat: oklch(94% 0.014 210);
  --selected: oklch(94% 0.031 240);
  --avatar: oklch(90% 0.045 235);
  --outgoing: oklch(94% 0.037 145);
  --error-surface: oklch(96% 0.025 25);
  font-size: 14px;
}

* {
  box-sizing: border-box;
}
header {
  min-height: 96px;
  padding: 20px 4vw;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.edition {
  color: var(--muted);
  font-size: 13px;
}
h3 {
  font-size: 15px;
  margin: 0 0 8px;
}
p {
  max-width: 72ch;
}
.lede {
  color: var(--muted);
  margin: 0 0 32px;
}
.heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
button,
input,
select,
textarea {
  font: inherit;
}
button:hover {
  opacity: 0.85;
}
button:active {
  opacity: 0.7;
}
button:disabled {
  opacity: 0.55;
  cursor: wait;
}
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 10px;
}
textarea,
select {
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 12px 14px;
  color: var(--ink);
  background: var(--paper);
}
textarea {
  resize: vertical;
  min-height: 200px;
  line-height: 1.6;
}
select {
  margin-bottom: 24px;
}
textarea[aria-invalid='true'] {
  border-color: var(--error);
}
.actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 20px;
}
.actions span,
.field-note {
  font-size: 13px;
  color: var(--muted);
}
.list small {
  display: block;
  color: var(--muted);
}
details {
  margin-top: 14px;
  font-size: 13px;
  color: var(--muted);
}
summary {
  cursor: pointer;
}
pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 12px;
  background: var(--surface);
  padding: 12px;
}
#notice {
  color: var(--error);
  margin-bottom: 20px;
}
#notice:empty {
  display: none;
}
#knowledge-summary {
  margin-bottom: 24px;
  color: var(--muted);
  font-size: 14px;
}
footer {
  padding: 20px 4vw;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 20px;
}
.skip {
  position: absolute;
  top: -100px;
  left: 20px;
  color: var(--paper);
  background: var(--accent);
  padding: 10px;
}
.skip:focus {
  top: 10px;
}
@media (prefers-reduced-motion: reduce) {
  button {
    transition: none;
  }
}
.compact-form {
  max-width: 530px;
}
.compact-form input {
  display: block;
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--paper);
  color: var(--ink);
  margin-bottom: 20px;
}
.section-title {
  margin-top: 44px;
}
.table-scroll {
  width: 100%;
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
th,
td {
  text-align: left;
  padding: 12px 14px 12px 0;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
th {
  font-weight: 600;
  color: var(--muted);
}

#knowledge-answer {
  min-height: 110px;
}

/* Messenger workspace: independent lists, reading pane and answer provenance. */

body {
  margin: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
body > header {
  height: 52px;
  min-height: 52px;
  padding: 0 16px;
  gap: 24px;
}
.brand {
  font-size: 17px;
  font-weight: 650;
  color: var(--ink);
  text-decoration: none;
}
.shell {
  min-height: 0;
  width: 100%;
  flex: 1;
}
nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-right: auto;
  overflow-x: auto;
}
nav button {
  background: transparent;
  color: var(--muted);
  white-space: nowrap;
}
nav button[aria-pressed='true'] {
  background: var(--selected);
  color: var(--accent);
}
main {
  height: 100%;
  min-height: 0;
  min-width: 0;
  padding: 0;
  overflow: auto;
}
main > section:not(#dialogs-view) {
  padding: 32px;
  max-width: 1050px;
}
h1 {
  font-size: 26px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.03em;
  margin: 0 0 16px;
}
h2 {
  font-size: 18px;
  line-height: 1.3;
  margin: 0 0 16px;
}
#dialogs-view {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 650;
  margin-bottom: 3px;
}
button {
  appearance: none;
  border: 0;
  padding: 7px 11px;
  background: var(--accent);
  color: var(--paper);
  font-weight: 500;
  line-height: 1.35;
  cursor: pointer;
  transition: background-color 150ms ease-out;
  border-radius: 7px;
}
button.secondary {
  color: var(--ink);
  background: var(--surface);
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --paper: oklch(23% 0.018 240);
  --surface: oklch(20% 0.018 240);
  --chat: oklch(17% 0.016 240);
  --ink: oklch(93% 0.009 235);
  --muted: oklch(73% 0.022 235);
  --line: oklch(35% 0.023 240);
  --accent: oklch(76% 0.115 240);
  --focus: oklch(81% 0.12 235);
  --selected: oklch(32% 0.055 240);
  --avatar: oklch(35% 0.06 240);
  --outgoing: oklch(30% 0.037 155);
  --error: oklch(80% 0.11 25);
  --error-surface: oklch(29% 0.045 25);
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}
#theme-toggle {
  padding: 7px 10px;
  white-space: nowrap;
  font-size: 12px;
  cursor: pointer;
}

.login {
  max-width: 360px;
  margin: 18vh auto 0;
  padding: 0 24px;
}
.login form {
  display: grid;
  gap: 10px;
}
.login-error {
  margin: 0;
  color: var(--error);
}
