:root {
  color-scheme: light;
  --primary: #b92031;
  --accent: #cc0000;
  --on-primary: #ffffff;
  --canvas: #ffffff;
  --panel: #f4f5f6;
  --text: #43494e;
  --muted: #6b7278;
  --border: #d5d8db;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--canvas);
  color: var(--text);
  font: 16px/1.45 Arial, Helvetica, sans-serif;
}

.gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.panel {
  width: 100%;
  max-width: 28rem;
  padding: 32px;
  text-align: center;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.panel h1 {
  margin: 0 0 8px;
  font-size: 1.25rem;
}

.panel p {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 0.9rem;
}

.panel code {
  display: block;
  margin: 0 0 24px;
  padding: 10px 12px;
  overflow-wrap: anywhere;
  text-align: left;
  color: var(--text);
  background: var(--canvas);
  border-radius: 8px;
}

.button {
  display: inline-block;
  width: 100%;
  padding: 10px 16px;
  border: 0;
  border-radius: 8px;
  background: var(--primary);
  color: var(--on-primary);
  font: inherit;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

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

.error {
  color: var(--primary);
}

.error-trace {
  max-height: 16rem;
  margin: 8px 0 0;
  padding: 10px 12px;
  overflow: auto;
  border-radius: 8px;
  background: var(--panel);
  color: var(--primary);
  white-space: pre-wrap;
  word-break: break-word;
  font: 0.8rem/1.45 ui-monospace, monospace;
}

.bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex: none;
  gap: 24px;
  align-items: center;
  min-height: 56px;
  padding: 0 24px;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  border-top: 3px solid var(--primary);
}

.bar-title {
  display: flex;
  gap: 10px;
  align-items: center;
  white-space: nowrap;
}

.brand {
  color: var(--primary);
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
}

.crumb {
  color: var(--muted);
  font-size: 0.9rem;
}

.crumb::before {
  content: "/";
  margin-right: 10px;
  color: var(--border);
}

.agent-version {
  margin-left: 4px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.nav,
.nav-main,
.nav-end {
  display: flex;
  gap: 4px;
  align-items: center;
}

.nav {
  flex: 1;
  justify-content: space-between;
}

.nav-link {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--text);
  font-size: 0.92rem;
  text-decoration: none;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.nav-link::-webkit-details-marker {
  display: none;
}

.nav-link:hover,
.menu[open] > .nav-link {
  background: var(--panel);
}

.menu > .nav-link::after {
  content: "";
  width: 6px;
  height: 6px;
  margin: -3px 0 0 2px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  opacity: 0.6;
}

.menu[open] > .nav-link::after {
  margin-top: 3px;
  transform: rotate(-135deg);
}

.nav-link.is-active,
.menu.is-active > .nav-link {
  color: var(--primary);
  font-weight: 600;
  box-shadow: inset 0 -2px 0 var(--primary);
  border-radius: 6px 6px 0 0;
}

.menu-debug > .nav-link {
  color: var(--muted);
  border: 1px dashed var(--border);
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--on-primary);
  font-size: 0.75rem;
  font-weight: 700;
}

.menu {
  position: relative;
}

.menu:not([open]) .menu-panel {
  display: none;
}

.menu-panel {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  left: 0;
  width: max-content;
  min-width: 12rem;
  max-width: 20rem;
  padding: 6px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(20, 24, 28, 0.12);
}

.menu-panel-end {
  right: 0;
  left: auto;
}

.menu-item {
  display: block;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
}

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

.menu-item strong {
  display: block;
  font-size: 0.92rem;
}

.menu-item span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

.menu-item[aria-current="page"] {
  background: #fbeced;
}

.menu-item[aria-current="page"] strong {
  color: var(--primary);
}

.menu-section {
  display: block;
  padding: 10px 10px 4px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.menu-section:not(:first-child) {
  margin-top: 4px;
  border-top: 1px solid var(--border);
}

.menu-meta {
  display: block;
  padding: 8px 10px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.8rem;
  overflow-wrap: anywhere;
}

.nav-toggle {
  display: none;
  margin-left: auto;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

@media (max-width: 960px) {
  .bar {
    flex-wrap: wrap;
    gap: 0 12px;
  }

  .nav-toggle {
    display: block;
  }

  .nav {
    display: none;
    flex-basis: 100%;
    flex-direction: column;
    align-items: stretch;
    padding: 4px 0 12px;
  }

  .bar.nav-open .nav {
    display: flex;
  }

  .nav-main,
  .nav-end {
    flex-direction: column;
    align-items: stretch;
  }

  .nav-end {
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px solid var(--border);
  }

  .nav-link.is-active,
  .menu.is-active > .nav-link {
    box-shadow: inset 2px 0 0 var(--primary);
    border-radius: 0 6px 6px 0;
  }

  .menu-panel,
  .menu-panel-end {
    position: static;
    width: auto;
    max-width: none;
    margin: 2px 0 6px 12px;
    box-shadow: none;
  }
}

.zerobus-page,
.mlflow-page,
.phoenix-page,
.permissions-page,
.docs-page,
.lake-page {
  min-height: 100vh;
}

.zerobus-page .panel,
.mlflow-page .panel,
.phoenix-page .panel,
.permissions-page .panel {
  margin: 48px auto;
}

.zerobus-page #grants {
  margin: 0 0 24px;
  padding: 0;
  text-align: left;
  list-style: none;
}

.zerobus-page #grants li {
  margin: 0 0 8px;
}

.zerobus-page #grants .present,
.permissions-page #groups .present {
  color: #1b7a3a;
}

.zerobus-page #grants .missing,
.permissions-page #groups .missing {
  color: var(--primary);
}

.permissions-page #groups {
  text-align: left;
}

.permissions-page #groups h2 {
  margin: 24px 0 8px;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.permissions-page #groups ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.permissions-page #groups li {
  margin: 0 0 8px;
}

.zerobus-page #result,
.mlflow-page #result,
.phoenix-page #result {
  margin-top: 24px;
  margin-bottom: 0;
  text-align: left;
  white-space: pre-wrap;
}

.docs-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.docs-page .stage {
  display: flex;
  flex: 1;
  min-height: 0;
}

.docs-sidebar {
  flex: 0 0 16rem;
  padding: 16px 20px 32px;
  overflow: auto;
  border-right: 1px solid var(--border);
  background: var(--panel);
}

.docs-sidebar h2 {
  margin: 20px 0 6px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.docs-sidebar h2:first-child {
  margin-top: 4px;
}

.docs-sidebar ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.docs-sidebar a {
  display: block;
  padding: 4px 8px;
  border-radius: 6px;
  color: var(--text);
  font-size: 0.9rem;
  text-decoration: none;
}

.docs-sidebar a:hover {
  background: #e8eaec;
}

.docs-sidebar a[aria-current="page"] {
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 600;
}

.docs-main {
  flex: 1;
  min-width: 0;
  overflow: auto;
}

.docs-body {
  max-width: 60rem;
  margin: 0 auto;
  padding: 24px 40px 64px;
}

.docs-body h1 {
  margin: 0 0 16px;
  color: var(--primary);
  font-size: 1.75rem;
}

.docs-body h2 {
  margin: 32px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  font-size: 1.3rem;
}

.docs-body h3 {
  margin: 24px 0 8px;
  font-size: 1.1rem;
}

.docs-body a {
  color: var(--accent);
}

.docs-body code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--panel);
  font: 0.85em ui-monospace, monospace;
}

.docs-body pre {
  padding: 12px 14px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
}

.docs-body pre code {
  padding: 0;
  background: none;
}

.docs-body pre.mermaid {
  text-align: center;
  background: #ffffff;
}

.docs-body pre.mermaid svg {
  display: inline-block;
}

.docs-body table {
  display: block;
  margin: 12px 0;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 0.9rem;
}

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

.docs-body th {
  background: var(--panel);
}

.docs-body blockquote {
  margin: 12px 0;
  padding: 4px 16px;
  border-left: 4px solid var(--primary);
  background: var(--panel);
}

@media (max-width: 720px) {
  .docs-page {
    height: auto;
    overflow: visible;
  }

  .docs-page .stage {
    flex-direction: column;
  }

  .docs-sidebar {
    flex: none;
    max-height: 40vh;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .docs-body {
    padding: 16px 20px 48px;
  }
}

.home-page {
  min-height: 100vh;
}

.home {
  width: 100%;
  max-width: 72rem;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

.home-group {
  margin: 0 0 32px;
}

.home-group h2 {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.home-group-debug {
  padding-top: 24px;
  border-top: 1px dashed var(--border);
}

.home-build {
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
}

.pages {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pages a {
  display: block;
  height: 100%;
  padding: 16px 20px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.pages a:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 14px rgba(20, 24, 28, 0.08);
}

.home-group-debug .pages a {
  background: #ffffff;
}

.pages a strong {
  display: block;
  margin-bottom: 4px;
}

.pages a span {
  color: var(--muted);
  font-size: 0.9rem;
}

.chat-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.chat {
  display: flex;
  flex: 1;
  width: 100%;
  max-width: 48rem;
  margin: 0 auto;
  padding: 24px;
  min-height: 0;
}

.chat deep-chat {
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
}


.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

form label {
  display: block;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.lake {
  max-width: 76rem;
  margin: 0 auto;
  padding: 16px 24px 64px;
}

.lake-head {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: center;
  margin-bottom: 16px;
}

.lake-brand {
  color: var(--accent);
  font-size: 1.75rem;
  text-decoration: none;
}

.lake-tabs,
.lake-chips,
.lake-modes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.lake-tabs button,
.lake-chips button,
.lake-modes button {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.lake-tabs button {
  font-size: 0.95rem;
}

.lake-tabs button.is-selected,
.lake-chips button.is-selected,
.lake-modes button.is-selected {
  border-color: var(--primary);
  background: #f8e8ea;
  color: var(--accent);
}

.lake-box {
  display: flex;
  align-items: center;
  height: 44px;
  padding: 0 6px 0 18px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
}

.lake-box input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  outline: none;
}

.lake-go,
.lake-button {
  padding: 5px 14px;
  border: 0;
  border-radius: 999px;
  background: var(--primary);
  color: var(--on-primary);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.lake-button.is-quiet {
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text);
}

.lake-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.lake-controls {
  display: grid;
  gap: 10px;
  margin: 12px 0 8px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
}

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

.lake .lake-label,
.lake-row > label {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.lake-row > label {
  display: flex;
  gap: 6px;
  align-items: center;
}

.lake-label {
  min-width: 7.5rem;
}

.lake-row input[type="text"],
.lake-row input[type="number"],
.lake-row input[type="search"],
.lake-row select {
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
}

.lake-row input[type="number"] {
  width: 5.5rem;
}

.lake-row input.kp-search {
  width: 22rem;
  max-width: 100%;
}

.lake-row input.is-wide {
  width: 22rem;
  max-width: 100%;
}

.lake-row input[type="checkbox"] {
  accent-color: var(--primary);
}

.lake-note,
.lake-muted,
.lake-summary {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.lake-summary {
  margin: 14px 0 18px;
  font-size: 0.9rem;
}

.lake-hits {
  margin: 0;
  padding: 0;
  list-style: none;
}

.lake-hits li.lake-hit {
  margin: 0 0 14px;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.lake-source {
  margin: 2px 0 0;
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

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

.lake-parts {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr);
  gap: 6px 14px;
  margin: 10px 0 0;
}

.lake-parts dt {
  padding-top: 2px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.lake-parts dd {
  min-width: 0;
  margin: 0;
}

.lake .lake-text {
  margin: 0;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.lake .lake-context {
  color: var(--muted);
  font-style: italic;
}

.lake .lake-keywords {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.lake-rich {
  display: grid;
  gap: 6px;
}

.lake-content .is-clamped {
  max-height: 11rem;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, #000 65%, transparent);
  mask-image: linear-gradient(to bottom, #000 65%, transparent);
}

.lake-more {
  margin-top: 4px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}

.lake-more:hover {
  text-decoration: underline;
}

.lake-block .lake-text {
  max-height: 32rem;
  overflow: auto;
}

.lake-detail .lake-fields {
  grid-template-columns: max-content minmax(0, 1fr) max-content minmax(0, 1fr);
}

.lake-table.lake-pairs th {
  width: 40%;
  position: static;
  background: var(--panel);
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: normal;
  text-transform: none;
  white-space: normal;
}

.lake-tag.is-more {
  border-style: dashed;
}

.lake-detail .lake-source {
  margin: -6px 0 12px;
}

.lake-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.lake-link:hover {
  text-decoration: underline;
}

.lake-hits h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 400;
}

.lake-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin: 2px 0 4px;
  color: var(--muted);
  font-size: 0.8rem;
}

.lake-hits p {
  margin: 4px 0 0;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.lake-hits p.lake-inspect {
  color: var(--muted);
  font-size: 0.75rem;
}

.lake mark {
  padding: 0 2px;
  border-radius: 2px;
  background: #ffe08a;
  color: #3c1f1f;
}

.lake-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.lake-tag {
  padding: 1px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  font: inherit;
  font-size: 0.72rem;
  cursor: pointer;
}

.lake-tag:hover {
  border-color: var(--primary);
  color: var(--accent);
}

.lake-badge {
  display: inline-block;
  padding: 0 6px;
  border-radius: 4px;
  background: var(--panel);
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 600;
}

.lake-badge.is-warn {
  background: #fdecc8;
  color: #7a4b00;
}

.lake-badge.is-ok {
  background: #dff3e4;
  color: #1d6b35;
}

.lake-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.lake-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.lake-table th,
.lake-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.lake-table th {
  position: sticky;
  top: 0;
  background: var(--panel);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

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

.lake-table td.is-num {
  text-align: right;
  white-space: nowrap;
}

.lake-table td.is-clip {
  max-width: 28rem;
  overflow-wrap: anywhere;
}

.lake-table td.is-id {
  font: 0.75rem ui-monospace, monospace;
  white-space: nowrap;
}

.lake-pager {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 10px 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.lake-stats {
  display: grid;
  gap: 24px;
}

.lake-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 12px;
}

.lake-card {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
}

.lake-card strong {
  display: block;
  color: var(--accent);
  font-size: 1.6rem;
  font-weight: 400;
}

.lake-section h2,
.lake-detail h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: 600;
}

.lake-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(22rem, 1fr));
  gap: 24px;
}

.lake-check {
  margin: 0 0 12px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.lake-check > summary {
  display: flex;
  gap: 10px;
  align-items: center;
  cursor: pointer;
}

.lake-check .lake-table-wrap {
  margin-top: 10px;
}

.lake-detail {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  width: min(48rem, 100vw);
  overflow-y: auto;
  padding: 16px 22px 48px;
  border-left: 1px solid var(--border);
  background: #ffffff;
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.08);
}

.lake-detail-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.lake-detail-head h2 {
  margin: 2px 0 0;
  color: var(--accent);
  font-size: 1.3rem;
  font-weight: 400;
}

.lake-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.lake-fields {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 14px;
  margin: 0 0 14px;
  font-size: 0.85rem;
}

.lake-fields dt {
  color: var(--muted);
}

.lake-fields dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.lake-block {
  margin: 0 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.lake-block > summary {
  padding: 8px 12px;
  background: var(--panel);
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.lake-block[open] > summary {
  border-radius: 10px 10px 0 0;
}

.lake-block > div {
  padding: 10px 12px;
}

.lake-pre {
  max-height: 28rem;
  margin: 0;
  padding: 10px 12px;
  overflow: auto;
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  font: 0.78rem/1.45 ui-monospace, monospace;
}

.lake-element {
  margin: 0 0 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.lake-element:last-child {
  border-bottom: 0;
}

.lake-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}

/* Graph page (static/graph.js): the 3D canvas fills the rest of the window. */
.graph-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.lake.graph {
  display: flex;
  flex: 1;
  flex-direction: column;
  width: 100%;
  max-width: none;
  min-height: 0;
  padding-bottom: 16px;
  box-sizing: border-box;
}

.lake.graph {
  padding-top: 10px;
}

.graph-top {
  display: grid;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
}

.graph-head {
  gap: 6px 14px;
}

.graph-head .lake-brand {
  font-size: 1.35rem;
}

.graph-head input.is-wide {
  width: 15rem;
}

.graph-hint {
  display: inline-grid;
  width: 18px;
  height: 18px;
  margin-left: -8px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: #ffffff;
  color: var(--muted);
  font-size: 0.7rem;
  cursor: help;
}

.graph-search {
  position: relative;
  flex: 1 1 22rem;
  min-width: 16rem;
}

.graph-search .lake-box {
  gap: 6px;
  height: 34px;
  padding-left: 14px;
  background: #ffffff;
}

.lake-row .graph-search select {
  display: inline-block;
  width: auto;
  margin: 0;
  padding: 2px 4px;
  border: 0;
  background: transparent;
  font-size: 0.8rem;
}

.graph-search .lake-go {
  padding: 4px 12px;
  font-size: 0.85rem;
}

.graph-hits {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  left: 0;
  z-index: 20;
  max-height: 60vh;
  overflow-y: auto;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.graph-hits[hidden] {
  display: none;
}

.graph-hits .lake-summary {
  margin: 4px 8px;
  font-size: 0.8rem;
}

.graph-hit {
  display: block;
  width: 100%;
  padding: 6px 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.graph-hit:hover,
.graph-hit:focus {
  background: var(--panel);
  outline: none;
}

.graph-hit strong {
  display: block;
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 500;
}

.graph-hit .lake-meta {
  font-size: 0.75rem;
}

.graph-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
}

.graph-filters .lake-label {
  min-width: 0;
}

.graph-filters .lake-chips + .lake-label {
  margin-left: 10px;
}

.graph .lake-chips button {
  padding: 2px 9px;
  font-size: 0.75rem;
}

.graph-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 24px;
  align-items: center;
  justify-content: space-between;
}

.graph-bar .lake-summary {
  margin: 4px 0;
  font-size: 0.82rem;
}

.graph-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  align-items: center;
  font-size: 0.8rem;
}

.graph-legend .lake-label {
  min-width: 0;
}

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

.graph-key i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.graph-key i.is-line {
  width: 16px;
  height: 3px;
  border-radius: 2px;
}

.graph-stage {
  position: relative;
  flex: 1;
  min-height: 360px;
}

@media (min-width: 1100px) {
  .graph-page.has-sheet .graph-stage {
    margin-right: calc(48rem - 12px);
  }
}

.graph-include {
  margin-left: 6px;
  padding: 2px 10px;
  font-size: 0.8rem;
}

.graph-canvas {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 12px;
  background: #101418;
}

.graph-focus {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  display: flex;
  gap: 10px;
  align-items: center;
  max-width: calc(100% - 24px);
  padding: 6px 12px 6px 6px;
  border-radius: 999px;
  background: rgba(16, 20, 24, 0.85);
  color: #ffffff;
  font-size: 0.85rem;
}

.graph-focus[hidden] {
  display: none;
}

.graph-focus span {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.graph-tip {
  max-width: 26rem;
  font-size: 0.8rem;
  line-height: 1.4;
}

.graph-tip-meta {
  opacity: 0.75;
}

@media (max-width: 720px) {
  .lake {
    padding: 12px 14px 48px;
  }

  .lake-label {
    min-width: 0;
    width: 100%;
  }

  .lake-parts,
  .lake-detail .lake-fields {
    grid-template-columns: 1fr;
  }
}

.slurry-page main {
  width: 100%;
  max-width: 40rem;
  margin: 48px auto;
  padding: 0 24px 48px;
}

.slurry-form h1 {
  margin: 0 0 8px;
  font-size: 2rem;
  font-weight: 500;
  text-align: center;
}

.slurry-lead,
.slurry-status,
.slurry-notes {
  color: var(--muted);
}

.slurry-lead {
  margin: 0 0 24px;
  text-align: center;
}

.slurry-fields {
  display: grid;
  grid-template-columns: 1fr 8rem auto;
  gap: 12px;
  align-items: end;
}

.slurry-fields label {
  margin-bottom: 0;
}

.slurry-fields input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
}

.slurry-fields .button {
  width: auto;
  padding: 10px 20px;
}

.slurry-fields.is-single {
  grid-template-columns: 1fr auto;
}

.lab-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.lab-options label {
  margin-bottom: 0;
}

.lab-inputs {
  margin-top: 12px;
}

.lab-inputs summary {
  cursor: pointer;
  font-weight: 600;
}

.lab-options input,
.lab-customer textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
}

.lab-customer {
  display: block;
  margin-top: 12px;
}

.lab-options select {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
}

.scorecard-head {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 12px;
}

.scorecard-head p {
  margin: 0;
}

.scorecard-score {
  min-width: 4.5rem;
  color: var(--accent);
  font-size: 2.75rem;
  font-weight: 600;
  line-height: 1;
}

.scorecard-tier {
  font-size: 1.25rem;
  font-weight: 600;
}

.scorecard[data-tier="Good"] .scorecard-score {
  color: #1f8a5b;
}

.scorecard[data-tier="Fair"] .scorecard-score,
.scorecard[data-tier="Poor"] .scorecard-score {
  color: #b7791f;
}

.job-header {
  margin-bottom: 16px;
  padding: 16px 20px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.job-header p {
  margin: 0;
}

.job-well {
  font-size: 1.35rem;
  font-weight: 600;
}

.job-line {
  margin-top: 4px;
}

.job-meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  white-space: pre-wrap;
}

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

.verdict-list li {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.verdict-list summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  cursor: pointer;
  list-style-position: inside;
}

.verdict-title {
  flex: 1;
  font-weight: 600;
}

.verdict-list .score {
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

.verdict-body {
  padding: 0 16px 12px;
  border-top: 1px solid var(--border);
}

.verdict-body p {
  margin: 8px 0 0;
}

.verdict-source {
  color: var(--muted);
  font-size: 0.85rem;
}

.scorecard .verdict-list li[data-result="pass"] .score {
  color: #1f8a5b;
}

.scorecard .verdict-list li[data-result="needs_review"] .score,
.scorecard .verdict-list li[data-result="soft_fail"] .score {
  color: #b7791f;
}

.scorecard-list {
  margin: 0;
  padding-left: 20px;
}

.scorecard-list li + li {
  margin-top: 6px;
}

.sq-uploads {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
}

.sq-uploads h2 {
  margin: 0 0 12px;
  font-size: 0.95rem;
  font-weight: 600;
}

.sq-uploads.is-dragover {
  border-color: var(--accent);
  border-style: dashed;
  outline: 2px dashed var(--accent);
  outline-offset: -6px;
}

.files-mode {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin: 0 0 12px;
}

form .files-mode label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 0.9rem;
  letter-spacing: normal;
  text-transform: none;
}

form .files-mode input {
  width: auto;
  margin: 0;
}

.files-reviewed {
  margin: 0 0 16px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  font-size: 0.88rem;
}

.files-reviewed p {
  margin: 0;
}

.files-reviewed p + p {
  margin-top: 4px;
  color: var(--muted);
}

form label.vida-choice {
  display: block;
  margin: 8px 0 0;
  font-size: 0.82rem;
}

form label.vida-choice select {
  display: block;
  width: 100%;
  margin-top: 4px;
}

.upload-drop-note {
  margin: -6px 0 12px;
  color: var(--muted);
  font-size: 0.85rem;
}

.upload-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.upload-row + .upload-row {
  margin-top: 12px;
}

form label.upload-button {
  position: relative;
  display: inline-block;
  width: auto;
  margin: 0;
  padding: 8px 16px;
  color: var(--on-primary);
  font-size: 0.9rem;
  letter-spacing: normal;
  text-transform: none;
}

.upload-button input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  opacity: 0;
}

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

.upload-hint {
  color: var(--muted);
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}

.plot-fields {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.plot-fields label {
  margin-bottom: 0;
}

.plot-fields input,
.plot-fields textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
}

.plot-fields textarea {
  min-height: 5.5rem;
  resize: vertical;
}

.plot-options {
  display: flex;
  gap: 16px;
}

.plot-options label {
  flex: 1;
}

.plot-ask {
  width: auto;
  align-self: start;
  padding: 10px 20px;
}

.suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.suggestions button {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
}

.plot-answer {
  margin: 0;
  font-size: 1.25rem;
  white-space: pre-wrap;
}

.contract-saved {
  margin: 16px 0;
}

.contract-mode {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.plot-fields .contract-mode input {
  display: inline;
  width: auto;
  margin: 0 6px 0 0;
}

.contract-matches {
  margin: 8px 0 12px;
}

.contract-steps > details > summary {
  cursor: pointer;
  color: var(--muted);
  padding: 6px 0;
}

/* Printing the ContractReader page: the contract only, no controls or processing steps. */
@media print {
  body.contract-page .bar,
  body.contract-page nav,
  body.contract-page #review-form,
  body.contract-page #saved-section,
  body.contract-page #trace,
  body.contract-page #matches,
  body.contract-page .contract-raw,
  body.contract-page .contract-filters,
  body.contract-page .contract-section > button {
    display: none !important;
  }

  body.contract-page .contract-section:not([open]) {
    display: none;
  }
}

.contract-view {
  display: grid;
  gap: 12px;
  margin: 12px 0;
}

.contract-group {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.contract-section > summary,
.contract-raw > summary {
  cursor: pointer;
  font-weight: 600;
  padding: 6px 0;
}

.contract-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 6px 0 8px;
}

.contract-json {
  max-height: 40rem;
  margin: 8px 0 0;
  padding: 10px 12px;
  overflow: auto;
  border-radius: 8px;
  background: var(--panel);
  font-size: 0.8rem;
}

.slurry-status {
  margin: 16px 0 0;
  text-align: center;
}

#trace,
.slurry-result {
  box-sizing: border-box;
  width: min(1440px, 100vw);
  margin-left: calc(50% - min(720px, 50vw));
  padding-right: 24px;
  padding-left: 24px;
}

.slurry-result {
  margin-top: 32px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.slurry-result-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.slurry-result-head .slurry-download {
  width: auto;
  padding: 6px 14px;
  font-size: 0.85rem;
}

.medallion-report {
  max-width: none;
  padding: 0;
}

.medallion-report table {
  max-width: 100%;
}

.slurry-headline {
  margin: 0 auto 8px;
  max-width: 60rem;
  font-size: 1.05rem;
  text-align: center;
}

.slurry-cumulative {
  margin: 0 0 16px;
  font-size: 1.75rem;
  text-align: center;
}

.slurry-sections {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.slurry-sections li {
  margin: 0;
  padding: 16px 20px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.slurry-sections h2 {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.slurry-sections .score {
  margin: 8px 0 0;
  color: var(--accent);
  font-size: 1.25rem;
}

.slurry-sections p {
  margin: 8px 0 0;
}

.slurry-notes {
  margin: 8px 0 0;
}

.slurry-materials-scroll {
  overflow-x: auto;
}

.slurry-materials table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.slurry-materials th,
.slurry-materials td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.slurry-materials th {
  background: var(--panel);
  font-weight: 600;
}

.slurry-materials tr.missing td {
  color: var(--muted);
}

.limit-flag {
  display: inline-block;
  margin-top: 4px;
  padding: 1px 6px;
  border-radius: 8px;
  font-size: 0.75rem;
}

.limit-flag--outside {
  background: #fde8ea;
  color: var(--accent);
}

.limit-flag--within {
  background: #e7f4ea;
  color: #2e7d32;
}

.limit-flag--review {
  background: #fff3e0;
  color: #b26a00;
}

.slurry-step-title {
  margin: 32px 0 12px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.trace,
.trace ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.trace-run,
.trace-turn,
.trace-node {
  margin: 0 0 12px;
  padding: 16px 20px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.trace-node {
  background: #ffffff;
}

.trace-turn > ol {
  margin-top: 12px;
  padding-left: 16px;
  border-left: 2px solid var(--border);
}

.trace-node[data-state="initiated"] {
  border-color: var(--accent);
}

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

.trace-head h2,
.trace-head h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.trace-head .badge--state {
  margin-left: auto;
}

.trace-meta,
.trace-elapsed {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.trace-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.trace-node p {
  margin: 10px 0 0;
}

.badge {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.badge--tool {
  background: var(--primary);
  color: var(--on-primary);
}

.badge--source {
  max-width: 100%;
  padding: 4px 8px;
  font-family: ui-monospace, monospace;
  font-weight: 500;
  letter-spacing: normal;
  white-space: normal;
  text-align: left;
  text-transform: none;
}

.badge-kind {
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

[data-state="initiated"] > .trace-head .badge--state,
[data-state="running"] > .trace-head .badge--state,
[data-state="streaming"] > .trace-head .badge--state,
[data-state="error"] > .trace-head .badge--state {
  background: #ffffff;
  color: var(--accent);
}

[data-state="complete"] > .trace-head .badge--state,
[data-state="unresolved"] > .trace-head .badge--state {
  background: var(--panel);
  color: var(--muted);
}

.spinner {
  width: 0.7rem;
  height: 0.7rem;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation: none;
  }
}

.slurry-step-label {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.trace-node pre {
  max-height: 16rem;
  margin: 6px 0 0;
  padding: 10px 12px;
  overflow: auto;
  border-radius: 8px;
  background: var(--panel);
  white-space: pre-wrap;
  word-break: break-word;
  font: 0.8rem/1.45 ui-monospace, monospace;
}

/* Step details (static/trace_details.js): model requests, SQL, prompts, files. */
.trace-details {
  margin-top: 10px;
}

.trace-details-label {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.trace-detail {
  margin-top: 6px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.trace-detail--request {
  border-left-color: var(--primary);
}

.trace-detail--sql {
  border-left-color: #2e7d32;
}

.trace-detail--llm {
  border-left-color: var(--accent);
}

.trace-detail--embedding,
.trace-detail--file {
  border-left-color: #b26a00;
}

.trace-detail > summary {
  cursor: pointer;
  font: 0.8rem/1.45 ui-monospace, monospace;
  word-break: break-word;
}

.trace-detail .trace-detail {
  margin-left: 4px;
}

.trace-details pre {
  max-height: 20rem;
  margin: 6px 0 0;
  padding: 10px 12px;
  overflow: auto;
  border-radius: 8px;
  background: var(--panel);
  white-space: pre-wrap;
  word-break: break-word;
  font: 0.8rem/1.45 ui-monospace, monospace;
}

.trace-messages {
  margin: 0;
  padding: 0;
  list-style: none;
}

.trace-message {
  margin-top: 8px;
}

.trace-message-head {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  font: 0.75rem ui-monospace, monospace;
  color: var(--muted);
}

.trace-role--system,
.trace-role--user {
  background: var(--primary);
  color: var(--on-primary);
}

.trace-role--tool_call,
.trace-role--tool {
  background: #e7f4ea;
  color: #2e7d32;
}

.trace-role--retry {
  background: #fde8ea;
  color: var(--accent);
}

@media (max-width: 720px) {
  .slurry-fields {
    grid-template-columns: 1fr;
  }

  .slurry-fields .button {
    width: 100%;
  }

  .upload-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .slurry-sections {
    grid-template-columns: 1fr;
  }
}

select,
textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
}

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

.upload-files li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.upload-files li:last-child {
  border-bottom: 0;
}

.upload-files .badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.upload-files li[data-state="stored"] .badge--state {
  background: var(--panel);
  color: var(--muted);
}

.upload-files li[data-state="skipped"] .badge--state {
  background: var(--panel);
  color: var(--muted);
}

.upload-files li[data-state="failed"] .badge--state {
  background: #ffffff;
  color: var(--accent);
}

.upload-log {
  max-height: 16rem;
  margin: 12px 0 0;
  padding: 10px 12px;
  overflow: auto;
  border-radius: 8px;
  background: var(--panel);
  white-space: pre-wrap;
  word-break: break-word;
  font: 0.8rem/1.45 ui-monospace, monospace;
}

/* SqLabTest v1: customer limits as rows (test, property, operator, value, unit). */
.limit-rows {
  display: grid;
  gap: 6px;
  margin-top: 6px;
}

.limit-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.limit-row select,
.limit-row input {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
}

.limit-row input {
  width: 7em;
}

.limit-unit {
  min-width: 3em;
  color: var(--muted, inherit);
}

.limit-add {
  margin-top: 6px;
}

/* The page-wide "select { display: block }" would show the hidden rheology property box and
   the hidden second "between" value; keep hidden parts of a limit row hidden. */
.limit-row [hidden] {
  display: none;
}

/* ---------------------------------------------------------------- Tests pages */
.tests {
  max-width: 76rem;
  margin: 0 auto;
  padding: 16px 24px 64px;
}

.tests-head {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 24px;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 16px;
}

.tests-head h1 {
  margin: 2px 0 4px;
  color: var(--accent);
  font-size: 1.75rem;
  font-weight: 400;
}

.tests-head .lake-note span + span::before {
  content: " · ";
}

.tests-head .lake-kicker a {
  color: inherit;
}

.tests-version select,
.tests-filters input[type="search"] {
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  font-size: 0.85rem;
}

.tests-version label {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 0.8rem;
}

.tests-banner {
  margin: 0 0 16px;
  padding: 4px 10px;
}

.tests-empty {
  padding: 24px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  color: var(--muted);
}

.tests-kpis {
  margin-bottom: 24px;
}

.tests-kpis .lake-card strong {
  margin: 4px 0;
}

.tests-score {
  display: inline-block;
  min-width: 2.4em;
  padding: 2px 8px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--tone, var(--muted)) 14%, #ffffff);
  color: var(--tone, var(--muted));
  font-size: 1.6rem;
  font-weight: 600;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.tests-score.is-small {
  min-width: 2.2em;
  padding: 0 6px;
  border-radius: 6px;
  font-size: 0.82rem;
}

[data-tone="great"] { --tone: #1d6b35; }
[data-tone="pass"] { --tone: #3f7d1f; }
[data-tone="warn"] { --tone: #9a5b00; }
[data-tone="fail"] { --tone: #b3261e; }
[data-tone="none"] { --tone: var(--muted); }

.tests-delta {
  margin-left: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.tests-delta[data-sign="up"] { color: #1d6b35; }
.tests-delta[data-sign="down"] { color: #b3261e; }
.tests-delta[data-sign="flat"] { color: var(--muted); }

.tests-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
  gap: 16px;
}

.tests-card {
  display: grid;
  gap: 8px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: inherit;
  text-decoration: none;
}

.tests-card:hover,
.tests-card:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

.tests-card h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
}

.tests-card .lake-fields {
  margin: 0;
}

.tests-minibars {
  display: flex;
  gap: 4px;
  align-items: flex-end;
  height: 36px;
}

.tests-minibars span {
  flex: 1;
  min-height: 2px;
  border-radius: 3px 3px 0 0;
  background: var(--tone, var(--muted));
  opacity: 0.75;
}

.tests-hist {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 6px;
  align-items: end;
  height: 160px;
  margin-bottom: 8px;
}

.tests-hist-bar {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.tests-hist-fill {
  align-self: end;
  min-height: 2px;
  border-radius: 4px 4px 0 0;
  background: var(--tone, var(--muted));
}

.tests-hist-bar:hover .tests-hist-fill {
  filter: brightness(1.15);
}

.tests-hist-count,
.tests-hist-label {
  font-size: 0.75rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.tests-hist-label {
  padding-top: 4px;
  border-top: 1px solid var(--border);
  color: var(--muted);
}

.lake-grid-2 + .lake-section,
.tests .lake-grid-2 {
  margin-bottom: 24px;
}

.tests-row {
  cursor: pointer;
}

.tests-row:hover td,
.tests-row:focus-visible td,
.tests-row.is-selected td {
  background: #fbf3f4;
}

.tests-questions td.is-clip {
  max-width: 24rem;
}

.tests-note {
  max-width: 28rem;
  min-width: 14rem;
  color: var(--muted);
  font-size: 0.78rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tests-filters {
  margin-bottom: 10px;
}

.tests-detail h2 {
  font-size: 1.1rem;
}

.tests-verdict {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-left: 4px solid var(--tone, var(--muted));
  border-radius: 8px;
  background: var(--panel);
}

.tests-verdict-head {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.tests-verdict p {
  margin: 8px 0 0;
  font-size: 0.9rem;
}

.tests-issues {
  margin: 8px 0 0;
  padding-left: 18px;
  font-size: 0.85rem;
}

.tests-compare {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.tests-compare h3 {
  margin: 0 0 6px;
  font-size: 0.85rem;
}

.tests-pre {
  font: 0.85rem/1.5 Arial, Helvetica, sans-serif;
}

.tests-source {
  margin: 0 0 8px;
  overflow-wrap: anywhere;
  font-size: 0.85rem;
}

.tests-cite + .tests-cite {
  margin-top: 10px;
}

.tests-cite strong {
  display: block;
  margin-bottom: 4px;
  font-size: 0.85rem;
}

.tests-searches {
  margin: 0;
  padding-left: 20px;
  font-size: 0.85rem;
}

@media (max-width: 720px) {
  .tests {
    padding: 12px 14px 48px;
  }

  .tests-note {
    display: none;
  }
}

/* Knowledge Profile page (static/knowledge_profile.js). */
.kp-badges {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
}

.kp-body,
.kp-gap-body {
  display: grid;
  gap: 12px;
  padding: 10px 12px;
}

.kp-detail-grid {
  display: grid;
  gap: 6px;
}

.kp-row {
  margin: 0;
}

.kp-field {
  display: grid;
  gap: 4px;
}

.kp-field > strong {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.kp-list {
  display: grid;
  gap: 4px;
}

.kp-list p {
  margin: 0;
}

.kp-excerpt {
  max-height: 8rem;
  overflow: auto;
  padding: 8px 10px;
  border-left: 3px solid var(--border);
  background: var(--panel);
}

.kp-sources {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
}

.kp-gap-body {
  grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
}

.kp-side {
  display: grid;
  gap: 6px;
  align-content: start;
}

.kp-side h3 {
  margin: 0;
  font-size: 0.95rem;
}

.kp-changes {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  background: var(--panel);
}

.kp-changes[hidden] {
  display: none;
}

.kp-changes p {
  margin: 0;
}

.kp-gap-block {
  padding: 14px 18px 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--canvas);
}

.kp-gap-block + .kp-gap-block {
  margin-top: 2rem;
}

.kp-block-title {
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  color: var(--accent);
  font-size: 1.25rem;
}

.kp-gap-heading {
  margin: 14px 0 8px;
  font-size: 0.95rem;
}

.kp-dash {
  display: grid;
  gap: 8px;
}

.kp-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 8px;
}

.kp-tile {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  font: inherit;
  color: inherit;
  text-align: left;
}

button.kp-tile {
  cursor: pointer;
}

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

.kp-tile-value {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent);
}

.kp-tile-label {
  font-size: 0.8rem;
  color: var(--muted);
}

.kp-gap-note {
  margin: 0 0 6px;
}

.kp-gap-section > summary {
  cursor: pointer;
}

.kp-dash-label {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

.kp-fold > summary {
  cursor: pointer;
}

.kp-fold > summary.kp-block-title {
  display: list-item;
  font-weight: bold;
}

.kp-verify {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.kp-verify-progress {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.kp-progress {
  width: 10rem;
  height: 0.6rem;
}



.kp-statusbar {
  display: flex;
  height: 0.9rem;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.kp-seg {
  border: 0;
  padding: 0;
  cursor: pointer;
  min-width: 2px;
}

.kp-seg.is-active {
  outline: 2px solid var(--text);
  outline-offset: -2px;
}

.kp-seg-complete { background: #2e7d32; }
.kp-seg-missing_conc_temp { background: #d98e04; }
.kp-seg-missing_conc { background: #e8a33d; }
.kp-seg-missing_temp { background: #f2c94c; }
.kp-seg-no_function { background: #c77f2f; }
.kp-seg-name_only { background: #b92031; }
.kp-seg-error { background: #6b7278; }
.kp-seg-pending { background: #d5d8db; }

.kp-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.kp-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  color: var(--muted);
}

.kp-legend-dot {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 2px;
}

.kp-src-bars {
  display: grid;
  gap: 6px;
  margin: 0.75rem 0;
}

.kp-src-bars .kp-statusbar {
  height: 1.4rem;
}

.kp-src-seg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  min-width: 2px;
  font-size: 0.68rem;
  color: #fff;
  white-space: nowrap;
}

.kp-src-group td {
  font-weight: 600;
}

.kp-src-group.is-toggle {
  cursor: pointer;
}

.kp-src-group.is-toggle:hover td {
  background: var(--panel);
}

.kp-src-sub td:first-child {
  padding-left: 1.5rem;
  font-weight: 400;
}

.kp-chip {
  font: inherit;
  font-size: 0.78rem;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
}

.kp-chip.is-active {
  border-color: var(--accent);
  color: var(--accent);
}

.kp-coverage {
  display: grid;
  gap: 4px;
  max-width: 42rem;
}

.kp-cov {
  display: grid;
  grid-template-columns: 7rem 1fr auto;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
}

.kp-cov-track {
  display: block;
  height: 0.55rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.kp-cov-fill {
  display: block;
  height: 100%;
  background: var(--accent);
}

.kp-families {
  display: grid;
  gap: 4px;
  max-width: 42rem;
}

.kp-family {
  display: grid;
  grid-template-columns: 13rem 1fr auto;
  align-items: center;
  gap: 8px;
  font: inherit;
  font-size: 0.85rem;
  padding: 3px 6px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: none;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.kp-family:hover,
.kp-family.is-active {
  border-color: var(--accent);
}

.kp-family-track {
  display: block;
  height: 0.55rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.kp-family-done {
  display: block;
  height: 100%;
  background: #2e7d32;
}

.kp-filterbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
}

.kp-chips {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 5px;
}

.kp-check {
  color: var(--muted);
  font-size: 0.85rem;
}

.kp-gap-section > summary {
  display: flex;
  align-items: center;
  gap: 10px;
}

.kp-share {
  flex: 1;
  max-width: 14rem;
  height: 0.4rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.kp-share-fill {
  display: block;
  height: 100%;
}

.kp-export {
  margin-left: auto;
  font-size: 0.75rem;
}

.kp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.kp-table th {
  text-align: left;
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 600;
  padding: 4px 8px;
  border-bottom: 1px solid var(--border);
}

.kp-table td {
  padding: 4px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.kp-row-main {
  cursor: pointer;
}

.kp-row-main:hover {
  background: var(--panel);
}

.kp-row-main.is-open {
  background: var(--panel);
}

.kp-detail-row td {
  background: var(--panel);
  padding: 10px 12px;
}

.kp-pill {
  display: inline-block;
  font-size: 0.72rem;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--muted);
  margin-right: 6px;
  white-space: nowrap;
}

.kp-row-muted td {
  color: var(--muted);
}

.kp-pill.is-bad {
  background: #f9d7d7;
  color: #8d1a1a;
  border-color: #eab9b9;
}

.kp-pill.is-amber {
  background: #fdecc8;
  color: #7a4b00;
  border-color: #f0d9a8;
}

.kp-pill.is-ok {
  background: #dff3e4;
  color: #1d6b35;
  border-color: #bfe3c8;
}

.kp-pill.is-grey {
  background: var(--panel);
  color: var(--muted);
}

.kpi-risk-detail {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 4px;
  font-size: 0.78rem;
}

.kpi-heat-wrap {
  margin-top: 12px;
}

.kpi-heat-title {
  margin: 0 0 6px;
  font-size: 0.95rem;
}

.kpi-heat {
  text-align: center;
  font-weight: 600;
}

td.kpi-low, .kpi-chip.kpi-low {
  background: #dff3e4;
  color: #1d6b35;
}

td.kpi-medium, .kpi-chip.kpi-medium {
  background: #fdecc8;
  color: #7a4b00;
}

td.kpi-high, .kpi-chip.kpi-high {
  background: #f9d7d7;
  color: #8d1a1a;
}

td.kpi-none, .kpi-chip.kpi-none {
  background: var(--panel);
  color: var(--muted);
}

.kpi-chip {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid var(--border);
  vertical-align: -1px;
}

.kp-ellipsis {
  display: inline-block;
  max-width: 18rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

td.is-warn {
  color: #b92031;
}

.kp-comp-wrap {
  margin-top: 8px;
}

.kp-comp-wrap > summary {
  cursor: pointer;
}
