/* Contextator admin dashboard — warm technical palette, no build step. */

:root {
  --bg: #f5f3ee;
  --bg-raised: #fbfaf7;
  --surface: #ffffff;
  --surface-2: #f5f3ee;
  --text: #1b1a17;
  --text-2: #4e4a42;
  --muted: #6b675e;
  --faint: #8a8578;
  --border: #e4e0d7;
  --border-strong: #d9d4c9;
  --accent: #0e6f66;
  --accent-hover: #0a5a53;
  --accent-tint: #e3f0ec;
  --on-accent: #ffffff;
  --ok: #1f7a43;
  --ok-text: #1f6b3b;
  --ok-tint: #e3f3e8;
  --warn: #c77700;
  --warn-text: #8a5100;
  --warn-tint: #fbf0da;
  --err: #c4302a;
  --err-text: #a1231b;
  --err-tint: #fbe5e3;
  --err-border: #f0c9c5;
  --neutral-tint: #eeebe4;
  --code-bg: #1b1a17;
  --code-fg: #ede9df;
  --code-border: #3a3833;
  --code-btn: #26241f;
  --shadow-dialog: 0 24px 60px rgba(27, 26, 23, 0.28);
  --backdrop: rgba(27, 26, 23, 0.42);
  --font-sans: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --font-serif: "Instrument Serif", Georgia, "Times New Roman", serif;
  --font-mono: "IBM Plex Mono", "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171613;
    --bg-raised: #1c1b17;
    --surface: #211f1b;
    --surface-2: #2a2823;
    --text: #ede9df;
    --text-2: #cfc9bb;
    --muted: #a39e91;
    --faint: #7f7a6e;
    --border: #33312b;
    --border-strong: #46433b;
    --accent: #3fa394;
    --accent-hover: #55b8a8;
    --accent-tint: #1d2f2c;
    --on-accent: #0f1412;
    --ok: #4fb56f;
    --ok-text: #7fd39a;
    --ok-tint: #1c2f22;
    --warn: #e69a2e;
    --warn-text: #f2be6e;
    --warn-tint: #352a15;
    --err: #e4655d;
    --err-text: #f39a94;
    --err-tint: #3a1f1d;
    --err-border: #5a2f2b;
    --neutral-tint: #2a2823;
    --code-bg: #0f0e0c;
    --code-fg: #ede9df;
    --code-border: #33312b;
    --code-btn: #1f1e1a;
    --shadow-dialog: 0 24px 60px rgba(0, 0, 0, 0.6);
    --backdrop: rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font: 14px / 1.45 var(--font-sans);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 600;
}

code,
pre {
  font-family: var(--font-mono);
  font-size: 12.5px;
}

p {
  margin: 0;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  opacity: 0.55;
  cursor: default;
}

/* Every `display` below would otherwise beat the hidden attribute the dashboard toggles. */
[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

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

/* ---------- top bar ---------- */

.topbar {
  height: 60px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-raised);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.logo {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--on-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
}

.brand-name {
  font-family: var(--font-serif);
  font-size: 22px;
  letter-spacing: 0.01em;
}

.brand-tag {
  font-size: 13px;
  color: var(--muted);
  padding-left: 12px;
  border-left: 1px solid var(--border);
  white-space: nowrap;
}

.health {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  font-size: 12.5px;
  color: var(--muted);
}

.health .mono {
  font-family: var(--font-mono);
  font-size: 12px;
}

.health .version {
  color: var(--faint);
  padding-left: 4px;
}

/* ---------- pills ---------- */

.pill,
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
}

.chip {
  background: var(--neutral-tint);
  color: var(--text-2);
}

.pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.pill.idle {
  background: var(--ok-tint);
  color: var(--ok-text);
}

.pill.idle::before {
  background: var(--ok);
}

.pill.indexing,
.pill.loading {
  background: var(--warn-tint);
  color: var(--warn-text);
}

.pill.indexing::before,
.pill.loading::before {
  background: var(--warn);
  animation: pulse 1s infinite alternate;
}

.pill.queued {
  background: var(--neutral-tint);
  color: var(--muted);
}

.pill.queued::before {
  background: var(--faint);
}

.pill.error {
  background: var(--err-tint);
  color: var(--err-text);
}

.pill.error::before {
  background: var(--err);
}

.pill.small {
  padding: 2px 8px;
  font-size: 11.5px;
}

@keyframes pulse {
  from {
    opacity: 0.3;
  }
  to {
    opacity: 1;
  }
}

/* ---------- layout ---------- */

.layout {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
}

.sidebar {
  width: 404px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  min-height: 0;
}

.sidebar-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 24px 20px 0 24px;
}

.sidebar-head h2 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 26px;
}

.sidebar-head .muted {
  font-size: 13px;
}

.sidebar-tools {
  display: flex;
  gap: 8px;
  padding: 14px 20px 16px 24px;
}

.search {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--muted);
  min-width: 0;
}

.search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

.search input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 14px;
  color: var(--text);
}

.project-list {
  flex: 1 1 auto;
  overflow: auto;
  padding: 0 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.project-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  text-align: left;
  color: inherit;
}

.project-row:hover {
  background: color-mix(in srgb, var(--surface) 60%, transparent);
}

.project-row.selected {
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent);
}

.project-row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.project-row .row-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot.idle {
  background: var(--ok);
}

.dot.indexing {
  background: var(--warn);
  animation: pulse 1s infinite alternate;
}

.dot.queued {
  background: var(--faint);
}

.dot.error {
  background: var(--err);
}

.project-row .row-name {
  flex: 1 1 auto;
  font-weight: 600;
  font-size: 15px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-row .row-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-left: 20px;
  font-size: 12px;
  color: var(--muted);
}

.project-row .row-bottom code {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.project-row .row-bottom .meta {
  white-space: nowrap;
  flex-shrink: 0;
}

.project-row .row-progress {
  margin-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--warn-text);
}

.bar {
  height: 4px;
  border-radius: 2px;
  background: var(--neutral-tint);
  overflow: hidden;
}

.bar > span {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: var(--warn);
  transition: width 0.4s ease;
}

.bar.indeterminate > span {
  width: 30%;
  animation: slide 1.2s infinite ease-in-out;
}

@keyframes slide {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(340%);
  }
}

.list-empty {
  padding: 24px 12px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

/* ---------- detail ---------- */

.detail {
  flex: 1 1 auto;
  min-width: 0;
  overflow: auto;
  padding: 28px 32px 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.detail-title {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.detail-title .title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.detail-title h1 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 40px;
  line-height: 1.1;
  word-break: break-all;
}

.url-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.url-row .url {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 13px;
  color: var(--text);
  word-break: break-all;
}

.url-row .path {
  font-size: 13px;
  color: var(--muted);
  word-break: break-all;
}

.detail-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding-top: 6px;
  flex-wrap: wrap;
}

.callout {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 18px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.callout.warn {
  background: var(--warn-tint);
  border-color: color-mix(in srgb, var(--warn) 35%, transparent);
  color: var(--warn-text);
}

.callout.error {
  background: var(--err-tint);
  border-color: var(--err-border);
  color: var(--err-text);
}

.callout .callout-title {
  font-weight: 600;
  font-size: 13.5px;
}

.callout pre {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12.5px;
  margin: 0;
}

.callout .bar {
  background: color-mix(in srgb, var(--warn) 20%, transparent);
}

/* A callout that carries a remedy puts the button on its own row, sized to its text rather than
   stretched by the column the callout is. */
.callout .callout-action {
  display: flex;
  gap: 8px;
  margin-top: 2px;
}

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

.stat {
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.stat .label {
  font-size: 12.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stat .value {
  font-family: var(--font-serif);
  font-size: 34px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.stat .value.mono {
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1.3;
  padding-top: 6px;
  word-break: break-all;
}

.stat .sub {
  font-size: 12.5px;
  color: var(--muted);
}

.stat .sub.warn {
  color: var(--warn-text);
}

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 16px;
  align-items: start;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
}

.panel-head {
  padding: 18px 20px 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.panel-head h3 {
  font-size: 16px;
}

.panel-head p {
  font-size: 13px;
  color: var(--muted);
}

.panel-body {
  padding: 16px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tabs {
  display: flex;
  gap: 4px;
  padding: 14px 20px 0;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.tab {
  height: 36px;
  padding: 0 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  border-radius: 0;
}

.tab[aria-selected="true"] {
  color: var(--text);
  font-weight: 600;
  border-bottom-color: var(--accent);
}

.tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.snippet {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 10px;
  background: var(--code-bg);
  color: var(--code-fg);
}

.snippet pre {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
  margin: 0;
}

.snippet .copy {
  flex-shrink: 0;
  height: 30px;
  padding: 0 10px;
  border-radius: 7px;
  border: 1px solid var(--code-border);
  background: var(--code-btn);
  color: var(--code-fg);
  font-size: 12.5px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.snippet .copy:hover {
  border-color: var(--code-fg);
}

.hint {
  font-size: 12.5px;
  color: var(--muted);
}

.tool-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tool {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-2);
}

.tool code {
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
}

.tool span {
  font-size: 12.5px;
  color: var(--text-2);
}

.run-grid {
  display: grid;
  grid-template-columns: 150px 110px minmax(0, 1fr) 90px;
  gap: 12px;
  align-items: center;
  font-size: 13.5px;
}

.run-grid.head {
  font-size: 13px;
  color: var(--muted);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--neutral-tint);
}

.run-grid .right {
  text-align: right;
  font-family: var(--font-mono);
}

.run-grid .result {
  color: var(--text-2);
  word-break: break-word;
}

.empty-state {
  margin: auto;
  max-width: 460px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 40px 0;
}

.empty-state h1 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 32px;
}

.empty-state p {
  color: var(--muted);
}

/* ---------- buttons ---------- */

.btn,
button.primary,
button.ghost,
button.danger,
button.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
}

button.primary {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
}

button.primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

button.ghost {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}

button.ghost:hover:not(:disabled) {
  border-color: var(--text-2);
}

button.danger {
  background: var(--surface);
  color: var(--err-text);
  border-color: var(--err-border);
  min-width: 118px;
}

button.danger.confirm {
  background: var(--err);
  border-color: var(--err);
  color: #ffffff;
}

button.icon {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 8px;
  background: var(--surface);
  border-color: var(--border);
  color: var(--muted);
}

button.icon:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

button.block {
  width: 100%;
  height: 44px;
}

button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- forms ---------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: 13px;
  font-weight: 600;
}

.field input {
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  font-size: 15px;
  outline: none;
  min-width: 0;
}

.field input[name="rootPath"],
.field input[type="password"] {
  font-family: var(--font-mono);
  font-size: 14px;
}

.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

.field input:user-invalid {
  border-color: var(--err);
}

.field-hint {
  font-size: 12.5px;
  color: var(--muted);
}

.field-hint code {
  color: var(--text);
}

.field-hint.center {
  text-align: center;
}

.check {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-raised);
  cursor: pointer;
}

.check input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.check > span {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.check-title {
  font-weight: 500;
}

.form-error {
  color: var(--err-text);
  font-size: 13px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--err-tint);
  border: 1px solid var(--err-border);
  white-space: pre-wrap;
}

/* ---------- dialog ---------- */

.dialog {
  width: min(560px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-dialog);
}

.dialog::backdrop {
  background: var(--backdrop);
}

.dialog form {
  display: flex;
  flex-direction: column;
}

.dialog-head {
  padding: 26px 28px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dialog-head h2 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 30px;
  line-height: 1.1;
}

.dialog-head p {
  font-size: 13.5px;
}

.dialog-body {
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.dialog-foot {
  padding: 16px 28px 22px;
  border-top: 1px solid var(--neutral-tint);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ---------- auth gate ---------- */

.gate {
  position: fixed;
  inset: 60px 0 0 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
}

.gate[hidden] {
  display: none;
}

.gate-card {
  width: min(460px, 100%);
  padding: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 12px 40px rgba(27, 26, 23, 0.08);
}

.gate-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--accent-tint);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.gate-card h1 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 30px;
  line-height: 1.1;
}

.gate-card > p.muted {
  font-size: 13.5px;
}

/* ---------- footer, toast ---------- */

.footer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 24px;
  color: var(--faint);
  font-size: 12px;
  padding: 11px 28px 13px;
  border-top: 1px solid var(--border);
}

.footer a {
  color: var(--muted);
  text-decoration: none;
}

.footer a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.footer a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
}

.footer-links a[aria-current="page"] {
  color: var(--accent);
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: var(--text);
  color: var(--bg);
  padding: 9px 16px;
  border-radius: 10px;
  font-size: 13px;
  opacity: 0;
  transition:
    opacity 0.2s,
    transform 0.2s;
  pointer-events: none;
  z-index: 20;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- search panel ---------- */

.search-form {
  display: flex;
  gap: 8px;
  align-items: center;
}

.search-input {
  flex: 1 1 auto;
  min-width: 0;
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  font-size: 14px;
  outline: none;
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

.search-input:disabled {
  opacity: 0.55;
}

.search-limit {
  flex: 0 0 auto;
  height: 38px;
  padding: 0 8px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 12.5px;
}

.search-form button {
  flex: 0 0 auto;
  height: 38px;
}

/* The two filters, on their own row under the question. Below and not beside it: they are the part
   of the request an operator sets once and then forgets, and the question is the part they retype. */
.search-filters {
  flex: 1 1 100%;
  display: flex;
  gap: 8px;
}

.search-filter {
  flex: 1 1 0;
  min-width: 0;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  outline: none;
}

.search-filter:focus {
  border-color: var(--accent);
}

.search-filter:disabled {
  opacity: 0.55;
}

.hit-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hit {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--surface-2);
}

.hit-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.hit-rank {
  flex: 0 0 auto;
  width: 20px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}

.hit-path {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hit-crumb {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Which half of retrieval returned this hit, and where. Pushed right with the score, and quieter
   than it: it explains the order, it is not the thing being compared. */
.hit-halves {
  flex: 0 0 auto;
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: var(--muted);
}

/* The number an operator compares two configurations with: never truncated, never pushed off. */
.hit-score {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}

/* Provenance of the excerpt's document: the link it came from, when it last changed there, and the
   server's "long unchanged" verdict. A line of its own so a long URL truncates instead of pushing the score. */
.hit-source {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  min-width: 0;
  font-size: 12px;
  color: var(--muted);
}

.hit-source-link {
  min-width: 0;
  max-width: 100%;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hit-source-link:hover {
  color: var(--accent-hover);
}

.hit-source-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

.hit-source-date {
  white-space: nowrap;
}

.pill.stale {
  background: var(--warn-tint);
  color: var(--warn-text);
}

.pill.stale::before {
  background: var(--warn);
}

/* The chunks either side of the excerpt. Dimmed rather than separated, because they are the same
   page continuing and they carry neither a rank nor a score of their own (ADR-0042). */
.hit-context {
  color: var(--muted);
}

.hit-body {
  margin: 0;
  max-height: 260px;
  overflow: auto;
  font-size: 12.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-2);
}

/* ---------- responsive ---------- */

@media (max-width: 1200px) {
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .search-form {
    flex-wrap: wrap;
  }
  .search-input {
    flex-basis: 100%;
  }
  .two-col {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  body {
    height: auto;
  }
  .topbar {
    height: auto;
    padding: 12px 16px;
    flex-wrap: wrap;
  }
  .brand-tag {
    display: none;
  }
  .health {
    justify-content: flex-start;
  }
  .layout {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .project-list {
    max-height: 40vh;
  }
  .detail {
    padding: 20px 16px 28px;
  }
  .detail-title h1 {
    font-size: 32px;
  }
  .run-grid {
    grid-template-columns: 1fr 1fr;
  }
  .run-grid.head {
    display: none;
  }
  .run-grid .result {
    grid-column: 1 / -1;
  }
  .run-grid .right {
    text-align: left;
  }
  .gate {
    inset: 0;
  }
}

@media (max-width: 560px) {
  .stats {
    grid-template-columns: minmax(0, 1fr);
  }
  .sidebar-tools {
    flex-wrap: wrap;
  }
}

.icon-wrap {
  display: inline-flex;
  align-items: center;
}

/* ---------- prefixed directory field (New project) ---------- */

.field-prefixed {
  display: flex;
  align-items: stretch;
  height: 44px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
}

.field-prefixed:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

.field-prefixed .prefix,
.field-prefixed .prefix-select {
  display: flex;
  align-items: center;
  padding: 0 12px;
  background: var(--surface-2);
  border: 0;
  border-right: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 13.5px;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.field-prefixed .prefix-select {
  font: inherit;
  font-family: var(--font-mono);
  color: var(--text);
  cursor: pointer;
  max-width: 220px;
}

.field-prefixed .prefix[hidden],
.field-prefixed .prefix-select[hidden] {
  display: none;
}

.field-prefixed input {
  flex: 1 1 auto;
  min-width: 0;
  height: auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0 14px;
  font-family: var(--font-mono);
  font-size: 14px;
  outline: none;
}

.field-prefixed input:focus {
  border: 0;
  box-shadow: none;
}

.runs-empty {
  font-size: 13px;
  color: var(--muted);
}

.run-grid .result.err {
  color: var(--err-text);
}

/* ---------- sources panel ---------- */

.sources-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--neutral-tint);
}

.sources-head h3 {
  font-size: 16px;
}

.sources-head p {
  font-size: 13px;
  color: var(--muted);
}

button.primary.small,
button.ghost.small,
button.danger.small {
  height: 30px;
  padding: 0 10px;
  font-size: 12.5px;
  border-radius: 8px;
  gap: 6px;
}

button.danger.small {
  min-width: 0;
}

.source-row {
  display: grid;
  grid-template-columns: 40px 180px minmax(0, 1fr) 100px 90px 120px auto;
  gap: 14px;
  align-items: center;
  padding: 12px 20px;
  border-bottom: 1px solid var(--neutral-tint);
}

.source-row:last-child {
  border-bottom: 0;
}

.source-glyph {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  background: var(--neutral-tint);
  color: var(--text-2);
}

.source-glyph.git {
  background: var(--accent-tint);
  color: var(--accent);
}

.source-glyph.error {
  background: var(--err-tint);
  color: var(--err-text);
}

/* Indexed, but not everything in it: a scanned PDF, a file over the conversion limit (ADR-0056). */
.source-glyph.warn {
  background: var(--warn-tint);
  color: var(--warn-text);
}

.source-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.source-cell code {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.source-cell .sub {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.source-cell .sub.err {
  color: var(--err-text);
}

/* A source that synced but could not index every file: a complaint, not a failure. */
.source-cell .sub.warn {
  color: var(--warn-text);
}

.source-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.sources-empty {
  padding: 24px 20px;
  font-size: 13px;
  color: var(--muted);
}

/* ---------- source dialog ---------- */

.dialog-wide {
  width: min(680px, calc(100vw - 32px));
}

.source-tabs {
  padding: 14px 28px 0;
}

.field-row {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 14px;
}

.field textarea,
.field select {
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  font: inherit;
  color: inherit;
  outline: none;
  min-width: 0;
}

.field select {
  height: 44px;
  padding: 0 12px;
}

.field textarea:focus,
.field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

.kind-only {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.check-row,
.radio-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13.5px;
  min-height: 44px;
  align-items: center;
}

.check-row label,
.radio-row label,
.check-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13.5px;
}

/* An author rule for `display` beats the UA stylesheet's [hidden], so hiding one has to be said here. */
.check-row label[hidden],
.radio-row label[hidden] {
  display: none;
}

.check-row input,
.radio-row input,
.check-inline input {
  margin: 0;
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.dialog-foot.space-between {
  justify-content: space-between;
}

.btn-row {
  display: flex;
  gap: 8px;
}

.webhook-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border: 1px dashed var(--border-strong);
  border-radius: 10px;
}

.webhook-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.webhook-row code {
  flex: 1 1 260px;
  min-width: 0;
  height: 34px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 26px 20px;
  border: 2px dashed var(--border-strong);
  border-radius: 14px;
  text-align: center;
  transition:
    border-color 0.15s,
    background 0.15s;
}

.dropzone.active,
.dropzone:focus-visible {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 7%, transparent);
  outline: none;
}

.dropzone-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.dropzone-title {
  font-size: 15px;
  font-weight: 600;
}

.dropzone-actions {
  display: flex;
  gap: 8px;
  padding-top: 4px;
}

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

.upload-queue .bar {
  height: 6px;
  border-radius: 3px;
}

.upload-queue .bar > span {
  background: var(--accent);
}

.upload-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  gap: 12px;
}

.bold {
  font-weight: 600;
}

.upload-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 160px;
  overflow: auto;
  font-size: 12.5px;
  font-family: var(--font-mono);
  color: var(--text-2);
}

.upload-list > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.upload-list > div > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-list .ok {
  color: var(--ok-text);
}

.upload-list .skip {
  color: var(--faint);
}

.upload-list .busy {
  color: var(--warn-text);
}

.upload-list .fail {
  color: var(--err-text);
}

@media (max-width: 900px) {
  .source-row {
    grid-template-columns: 40px minmax(0, 1fr);
  }
  .source-row > :nth-child(n + 3) {
    grid-column: 2;
  }
  .field-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- product and legal pages (/about, /privacy, /cookies, /terms, /license) ---------- */

a.brand {
  color: inherit;
  text-decoration: none;
}

a.btn.ghost {
  height: 34px;
  padding: 0 14px;
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}

a.btn.ghost:hover {
  border-color: var(--text-2);
}

/* The one place an anchor-button stands in for `button.block` — the /login SSO alternative. */
a.btn.ghost.block {
  width: 100%;
  height: 44px;
  font-size: 14px;
}

a.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.page {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 44px 32px 56px;
}

.page-doc {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  color: var(--text-2);
  line-height: 1.65;
}

.page-doc h1 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 40px;
  line-height: 1.1;
  color: var(--text);
}

.page-doc h2 {
  font-size: 17px;
  color: var(--text);
  padding-top: 18px;
}

.page-lead {
  font-size: 16px;
  color: var(--text-2);
}

.page-meta {
  font-size: 12.5px;
  color: var(--faint);
  margin-top: -6px;
}

.page-note {
  font-size: 12.5px;
  color: var(--faint);
}

.page-doc a {
  color: var(--accent);
}

.page-doc ul {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.page-doc strong {
  color: var(--text);
  font-weight: 600;
}

.page-doc code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 5px;
  white-space: nowrap;
}

.page-license {
  margin: 0;
  padding: 18px 20px;
  border-radius: 12px;
  background: var(--code-bg);
  color: var(--code-fg);
  border: 1px solid var(--code-border);
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-x: auto;
}

.page-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.page-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.page-table th {
  font-weight: 600;
  color: var(--text);
  background: var(--surface-2);
  white-space: nowrap;
}

.page-table th,
.page-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--neutral-tint);
  vertical-align: top;
}

.page-table tr:last-child td {
  border-bottom: 0;
}

@media (max-width: 900px) {
  .page {
    padding: 28px 16px 40px;
  }
  .page-doc h1 {
    font-size: 32px;
  }
  .footer {
    padding: 12px 16px 14px;
  }
}

/* ---------- top bar: the account menu ---------- */

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
  /* The account menu keeps its width; the health chips are what wraps when space runs out. */
  flex: 1;
  justify-content: flex-end;
}

.topbar-right .health {
  min-width: 0;
  flex-shrink: 1;
  flex-wrap: nowrap;
}

/* The model id is the longest thing up here; let it ellipsise rather than push the version down. */
.topbar-right .health .chip.mono {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Until app.js knows who is signed in, the chrome stays out of the way rather than flashing empty. */
body.booting .layout,
body.booting .topbar-right {
  visibility: hidden;
}

.user-menu {
  position: relative;
  flex-shrink: 0;
}

button.user-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
}

button.user-btn:hover {
  border-color: var(--border-strong);
}

.avatar {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: var(--neutral-tint);
  color: var(--text-2);
  flex-shrink: 0;
}

.avatar.root {
  background: var(--accent);
  color: var(--on-accent);
}

.avatar.admin {
  background: var(--accent-tint);
  color: var(--accent);
}

.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 30;
  min-width: 220px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-dialog);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.menu-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.menu-head .bold {
  font-weight: 600;
  font-size: 13.5px;
}

.menu-head .sub {
  font-size: 12px;
  color: var(--muted);
}

.menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
}

.menu-item:hover,
.menu-item:focus-visible {
  background: var(--surface-2);
}

.menu-sep {
  display: block;
  height: 1px;
  margin: 4px 0;
  background: var(--border);
}

.menu-item.danger-text {
  color: var(--err-text);
}

/* ---------- role pills ---------- */

.pill.root {
  background: var(--accent);
  color: var(--on-accent);
}

.pill.root::before {
  background: var(--on-accent);
}

.pill.admin,
.pill.editor,
/* An active API token. The MCP access modes no longer use it: they share the neutral .auth-mode pill. */
.pill.account {
  background: var(--accent-tint);
  color: var(--accent);
}

.pill.admin::before,
.pill.editor::before,
.pill.account::before {
  background: var(--accent);
}

.pill.member,
.pill.viewer,
.pill.you,
/* A project's MCP access mode. One look for all three — open, token, account — because each is a choice
   the operator made and none of them is a fault (ADR-0065): no warning colour, no icon. */
.pill.auth-mode {
  background: var(--neutral-tint);
  color: var(--muted);
}

.pill.member::before,
.pill.viewer::before,
.pill.you::before,
.pill.auth-mode::before {
  background: var(--faint);
}

/* ---------- users view ---------- */

body.no-sidebar .sidebar {
  display: none;
}

.back-link {
  display: inline-block;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
}

.back-link:hover {
  color: var(--text);
}

.users-lead {
  max-width: 62ch;
  margin-top: 6px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--muted);
}

.user-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1.4fr) auto minmax(0, 0.9fr) minmax(0, 0.8fr) minmax(0, 0.8fr) auto;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.user-row:last-child {
  border-bottom: 0;
}

.user-glyph {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--neutral-tint);
  color: var(--muted);
}

.user-glyph.root {
  background: var(--accent);
  color: var(--on-accent);
}

.user-glyph.admin {
  background: var(--accent-tint);
  color: var(--accent);
}

.user-role {
  display: flex;
  align-items: center;
  gap: 6px;
}

.users-empty {
  padding: 18px 0;
  color: var(--muted);
  font-size: 13.5px;
}

#user-password-field .btn-row {
  display: flex;
  gap: 8px;
}

#user-password-field .grow {
  flex: 1;
  min-width: 0;
}

/* ---------- members panel ---------- */

.member-row {
  grid-template-columns: 34px minmax(0, 2fr) auto minmax(0, 0.8fr) auto;
}

.role-select {
  height: 30px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 12.5px;
}

.members-note {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--warn-tint);
  color: var(--warn-text);
  font-size: 12.5px;
  line-height: 1.5;
}

.members-note code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  word-break: break-all;
}

/* ---------- auth pages (/login, /setup, /change-password) ---------- */

/* These documents have no dashboard layout, so the card centres in the whole page. */
body.auth {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

body.auth .gate {
  position: static;
  flex: 1;
  padding: 48px 24px;
}

body.auth .gate-card h1 {
  margin-bottom: 2px;
}

body.auth .gate-card .btn-row,
body.auth .gate-card .field + .field {
  margin-top: 0;
}

body.auth .gate-card a {
  color: var(--accent);
}

/* ---------- responsive: accounts ---------- */

@media (max-width: 900px) {
  .topbar-right {
    width: 100%;
    justify-content: space-between;
  }
  .user-row,
  .member-row {
    grid-template-columns: 34px minmax(0, 1fr) auto;
    row-gap: 8px;
  }
  .user-row > :nth-child(n + 4):not(.source-actions),
  .member-row > :nth-child(n + 4):not(.source-actions) {
    display: none;
  }
  .user-row .source-actions,
  .member-row .source-actions {
    grid-column: 1 / -1;
    flex-wrap: wrap;
  }
}

@media (max-width: 560px) {
  button.user-btn .user-name,
  button.user-btn .pill {
    display: none;
  }
  .menu {
    min-width: 200px;
  }
}

/* ---------- MCP access panel ---------- */

.token-row {
  grid-template-columns: 34px minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) auto;
}

.mcp-token-row {
  grid-template-columns: 34px minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) auto;
}

.mcp-token-row > .pill {
  justify-self: start;
}

/* Narrow: the created and used columns drop out (the .user-row rule above); the expiry stays. */
@media (max-width: 900px) {
  .mcp-token-row {
    grid-template-columns: 34px minmax(0, 1fr) auto;
  }
}

.source-glyph.token {
  background: var(--accent-tint);
  color: var(--accent);
  font-size: 9.5px;
}

.token-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 14px;
}

/* The members note reads as a warning by default; once the endpoint is closed it is reassurance. */
.members-note.ok {
  background: var(--ok-tint);
  color: var(--ok-text);
}

#token-secret-dialog .snippet + .field-label {
  margin-top: 16px;
}

#token-secret-dialog .field-label {
  display: block;
  margin-bottom: 6px;
}

/* ---------- the query log panel (queries.js, ADR-0050) ---------- */

.queries-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

/* An anchor, not a button: the export is a download the browser does with the session cookie. */
.button-like {
  display: inline-flex;
  align-items: center;
  padding: 5px 11px;
  border: 1px solid var(--neutral-tint);
  border-radius: 7px;
  text-decoration: none;
  font-size: 13px;
  color: var(--text-2);
}

.button-like:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.queries-config {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--neutral-tint);
}

.queries-config .field-hint.warn {
  color: var(--warn-text);
}

.queries-table {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.query-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 70px 80px 90px;
  gap: 12px;
  align-items: start;
  font-size: 13.5px;
}

.query-grid.doc {
  grid-template-columns: minmax(0, 1fr) 100px 110px;
}

.query-grid.vol {
  grid-template-columns: 100px minmax(0, 1fr) 80px 90px;
  align-items: center;
}

.query-grid.head {
  font-size: 13px;
  color: var(--muted);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--neutral-tint);
}

.query-grid .right {
  text-align: right;
}

.query-grid .mono {
  font-family: var(--font-mono);
}

.query-grid .warn {
  color: var(--warn-text);
}

.query-cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.query-text {
  word-break: break-word;
}

.query-cell .sub {
  font-size: 12px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.vol-bar {
  display: block;
  height: 8px;
  border-radius: 4px;
  background: var(--neutral-tint);
  overflow: hidden;
}

.vol-bar span {
  display: block;
  height: 100%;
  background: var(--accent);
}

/* ---------- the audit panel (audit.js, ADR-0055) ---------- */

.audit-controls {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--neutral-tint);
}

/* A wrapping label, so the control needs no id and index.html needs no markup for this panel. */
.audit-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.audit-field .search-limit {
  max-width: 100%;
}

.audit-controls .search-limit:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.audit-table {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  /* A year of admin actions is wider than a phone; the table scrolls, the page does not. */
  overflow-x: auto;
}

.audit-grid {
  display: grid;
  grid-template-columns: 168px minmax(120px, 0.9fr) minmax(0, 2.4fr) 60px;
  gap: 12px;
  align-items: start;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
  min-width: 660px;
}

.audit-grid:last-child {
  border-bottom: 0;
}

.audit-grid.head {
  font-size: 13px;
  color: var(--muted);
  padding: 0 0 8px;
  border-bottom: 1px solid var(--neutral-tint);
}

.audit-grid .right {
  text-align: right;
}

.audit-grid .mono {
  font-family: var(--font-mono);
}

.audit-when,
.audit-actor,
.audit-cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.audit-who {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.audit-summary {
  overflow-wrap: anywhere;
}

.audit-when .mono {
  font-family: var(--font-mono);
  font-size: 12.5px;
  white-space: nowrap;
}

.audit-cell .sub,
.audit-actor .sub,
.audit-when .sub {
  font-size: 12px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.audit-cell .sub.warn {
  color: var(--warn-text);
}

.audit-pager {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 14px;
}

.audit-foot {
  max-width: 78ch;
  margin: 14px 0 0;
  line-height: 1.55;
}

@media (max-width: 720px) {
  .audit-field {
    flex: 1 1 140px;
  }
  /* Four columns do not fit a phone. The row becomes two lines — when and who, then what and the
     status — rather than a table the reader has to push sideways to finish a sentence in. */
  .audit-grid {
    grid-template-columns: minmax(0, 1fr) auto;
    min-width: 0;
    row-gap: 4px;
  }
  .audit-grid.head {
    display: none;
  }
}

/* The price of a relevance floor, shown before it is applied (queries.js). */
.floor-preview {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--neutral-tint);
  border-radius: 7px;
}

.floor-preview .field-hint.warn {
  color: var(--warn-text);
}

.floor-samples ul {
  margin: 4px 0 8px;
  padding-left: 18px;
  font-size: 13px;
}

/* ---------- quotas panel ---------- */

.quota-list {
  display: grid;
}

.quota-row {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr) minmax(120px, 220px) auto;
  align-items: center;
  gap: 8px 16px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--neutral-tint);
}

.quota-row:last-child {
  border-bottom: 0;
}

.quota-label {
  font-weight: 600;
  font-size: 13.5px;
}

.quota-figures {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-2);
  overflow-wrap: anywhere;
}

.quota-meter {
  display: block;
  height: 6px;
  border-radius: 3px;
  background: var(--neutral-tint);
  overflow: hidden;
}

.quota-meter-fill {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--ok);
}

.quota-meter.near .quota-meter-fill {
  background: var(--warn);
}

.quota-meter.full .quota-meter-fill {
  background: var(--err);
}

#quotas-panel > .hint,
#quotas-panel > .form-error,
#quotas-panel > .field-hint {
  padding: 12px 20px;
}

@media (max-width: 720px) {
  .quota-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .quota-label {
    grid-column: 1 / -1;
  }

  .quota-meter {
    grid-column: 1 / -1;
    grid-row: 3;
  }
}

.quota-meter.none {
  opacity: 0.45;
}

/* ---------- MCP token address allowlist ---------- */

.token-networks {
  overflow-wrap: anywhere;
}

.token-networks.restricted {
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 11.5px;
}

.token-limits {
  margin-top: 14px;
  line-height: 1.5;
}

.token-limits code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  overflow-wrap: anywhere;
}

/* ---------- suggested relevance floor ---------- */

.floor-suggestions {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--neutral-tint);
}

.floor-suggestion-list {
  display: grid;
  gap: 8px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.floor-suggestion {
  padding: 10px 12px;
  border: 1px solid var(--neutral-tint);
  border-radius: 7px;
}

.floor-suggestion p {
  margin: 4px 0 0;
}

.floor-suggestion .field-hint.warn {
  color: var(--warn-text);
}

.floor-suggestion-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
}

/* ---------- source freshness ---------- */

.source-fresh {
  align-items: flex-start;
  gap: 4px;
}

/* ---------- golden questions ---------- */

a.btn.ghost.small {
  height: 30px;
  padding: 0 10px;
  font-size: 12.5px;
  border-radius: 8px;
  gap: 6px;
}

.golden-list {
  display: grid;
  gap: 8px;
  margin: 12px 20px 10px;
  padding: 0;
  list-style: none;
}

.golden-item {
  padding: 10px 12px;
  border: 1px solid var(--neutral-tint);
  border-radius: 7px;
}

.golden-item p {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
}

.golden-item .source-actions {
  margin-top: 8px;
}

/* Three header buttons do not fit beside the text on a phone: let the head and the buttons wrap. */
#golden-panel > .sources-head {
  flex-wrap: wrap;
}

#golden-panel > .sources-head .source-actions {
  flex-wrap: wrap;
  justify-content: flex-start;
}

.golden-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
}

.golden-key {
  font-family: var(--font-mono);
  font-size: 12px;
}

.golden-tag {
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--neutral-tint);
  color: var(--text-2);
  font-size: 11.5px;
}

.golden-expect code {
  font-family: var(--font-mono);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.golden-eval {
  padding: 12px 20px 16px;
  border-top: 1px solid var(--neutral-tint);
}

#golden-panel > .hint,
#golden-panel > div > .hint,
#golden-panel > .form-error {
  padding: 12px 20px;
}

.golden-command {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.golden-command code {
  min-width: 0;
  padding: 6px 10px;
  border-radius: 7px;
  background: var(--neutral-tint);
  font-family: var(--font-mono);
  font-size: 12px;
  overflow-wrap: anywhere;
}

/* ---------- eval runs (eval.js, ADR-0124) ---------- */

/* Two header buttons beside the text do not fit on a phone: let the head and the buttons wrap. */
#eval-panel > .sources-head {
  flex-wrap: wrap;
}

#eval-panel > .sources-head .source-actions {
  flex-wrap: wrap;
  justify-content: flex-start;
}

#eval-panel > .hint,
#eval-panel > .form-error,
#eval-panel > .eval-wait {
  padding: 12px 20px;
}

#eval-panel > .eval-notice {
  margin: 14px 20px 0;
}

.eval-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px 20px 20px;
  min-width: 0;
}

.eval-banner {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--err-border);
  background: var(--err-tint);
  color: var(--err-text);
  font-size: 13px;
  line-height: 1.5;
}

.eval-banner.skipped {
  border-color: var(--border-strong);
  background: var(--warn-tint);
  color: var(--warn-text);
}

.eval-banner p {
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.eval-keys {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
}

.eval-key-chip {
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  font-family: var(--font-mono);
  font-size: 11.5px;
  overflow-wrap: anywhere;
}

.eval-figures {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.eval-figure {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--neutral-tint);
  border-radius: 10px;
  min-width: 0;
}

.eval-figure-label {
  color: var(--muted);
  font-size: 12px;
}

.eval-figure-value {
  font-size: 20px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.eval-chart {
  margin: 0;
  min-width: 0;
}

.eval-svg {
  display: block;
  width: 100%;
  max-width: 560px;
  height: auto;
}

.eval-grid {
  stroke: var(--border);
  stroke-width: 1;
}

.eval-axis {
  fill: var(--muted);
  font-family: var(--font-sans);
  font-size: 11px;
}

.eval-line {
  fill: none;
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.eval-line.recall {
  stroke: var(--accent);
}

.eval-line.mrr {
  stroke: var(--warn);
  stroke-dasharray: 5 4;
}

.eval-dot.recall {
  fill: var(--accent);
}

.eval-dot.mrr {
  fill: var(--warn);
}

.eval-lost {
  fill: none;
  stroke: var(--err);
  stroke-width: 2;
}

.eval-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 14px;
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--text-2);
}

.eval-key {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.eval-key::before {
  content: "";
  width: 18px;
  height: 0;
  border-top: 2px solid var(--accent);
}

.eval-key.mrr::before {
  border-top: 2px dashed var(--warn);
}

.eval-key.lost::before {
  width: 10px;
  height: 10px;
  border: 2px solid var(--err);
  border-radius: 50%;
}

.eval-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.eval-run {
  padding: 8px 12px;
  border: 1px solid var(--neutral-tint);
  border-radius: 7px;
}

.eval-run.regressed {
  border-color: var(--err-border);
}

.eval-run-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
}

.eval-when {
  font-weight: 500;
}

.eval-trigger {
  color: var(--muted);
  font-size: 12.5px;
}

.eval-nums {
  flex: 1 1 220px;
  min-width: 0;
  font-size: 12.5px;
  color: var(--text-2);
  overflow-wrap: anywhere;
}

.eval-run-body {
  display: grid;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--neutral-tint);
}

.eval-run-body p {
  margin: 0;
  overflow-wrap: anywhere;
}

.eval-run-body .eval-keys {
  align-items: baseline;
}

@media (prefers-reduced-motion: no-preference) {
  .eval-dot {
    transition: r 0.15s;
  }
}
