/* ==========================================================================
   Judgment RAG Console — application styles
   Layout, components and responsive rules shared by every design theme.
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

html.dialog-open {
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Keep the decorative backdrop on its own fixed layer. A fixed body
   background repaints while scrolling and can flash on macOS compositors. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image: var(--page-backdrop);
  background-repeat: no-repeat;
  pointer-events: none;
}

body::selection {
  background: var(--selection);
}

::selection {
  background: var(--selection);
}

h1,
h2,
h3,
h4,
p,
figure {
  margin: 0;
}

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

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

button {
  cursor: pointer;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-hover);
}

img,
svg {
  display: block;
  max-width: 100%;
}

code,
kbd,
pre,
samp {
  font-family: var(--font-mono);
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border: 3px solid transparent;
  border-radius: 10px;
  background-clip: content-box;
}

::-webkit-scrollbar-track {
  background: transparent;
}

/* --------------------------------------------------------------- helpers */
.skip-link {
  position: fixed;
  top: -60px;
  left: 16px;
  z-index: 200;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--action-bg);
  color: var(--action-ink);
  font-weight: 600;
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 12px;
}

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

.mono {
  font-family: var(--font-mono);
  font-variant-ligatures: none;
}

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

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

.nowrap {
  white-space: nowrap;
}

.grow {
  flex: 1;
}

/* ------------------------------------------------------------- app shell */
:root {
  --settings-width: 380px;
}

.app-shell {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: padding-right 0.24s ease;
}

body.settings-open .app-shell {
  padding-right: var(--settings-width);
}

body.settings-open .primary-nav {
  overflow-x: auto;
  scrollbar-width: none;
}

body.settings-open .primary-nav::-webkit-scrollbar {
  display: none;
}

body.settings-open .toast-region {
  right: calc(var(--settings-width) + 18px);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 20px;
  height: var(--header-height);
  padding: 0 clamp(16px, 3vw, 40px);
  /* Keep the sticky header opaque: live backdrop blur repaints on every
     scroll frame and can flash on macOS compositors. */
  background-color: var(--bg);
  background-image: linear-gradient(var(--header-bg), var(--header-bg));
  color: var(--header-ink);
  border-bottom: 1px solid var(--header-line);
  box-shadow: var(--header-shadow);
}

.app-header::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: var(--brand-bar);
  pointer-events: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: none;
  color: var(--header-ink);
}

.brand:hover {
  color: var(--header-ink);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--action-bg);
  color: var(--action-ink);
  box-shadow: var(--shadow-xs);
}

.brand-mark svg {
  width: 22px;
  height: 22px;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}

.brand-copy strong {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.brand-copy span {
  margin-top: 4px;
  color: var(--header-muted);
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 500;
  letter-spacing: 0.2em;
}

.primary-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 13px;
  border-radius: var(--radius-pill);
  color: var(--header-muted);
  font-size: 13.5px;
  font-weight: 550;
  white-space: nowrap;
  transition: background 0.18s ease, color 0.18s ease;
}

.nav-link svg {
  width: 17px;
  height: 17px;
  flex: none;
}

.nav-link:hover {
  background: var(--accent-soft);
  color: var(--header-ink);
}

.nav-link.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 650;
}

[data-theme="nvidia"] .nav-link.is-active,
[data-theme="ibm"] .nav-link.is-active {
  background: var(--accent);
  color: var(--accent-ink, #ffffff);
}

[data-theme="linear"] .nav-link.is-active {
  background: var(--surface-3);
  color: var(--ink);
}

.nav-update-badge {
  position: absolute;
  right: 2px;
  bottom: 1px;
  min-width: 15px;
  height: 15px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--warning);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  line-height: 15px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--header-bg, var(--bg));
  pointer-events: none;
}

.nav-update-badge[hidden] {
  display: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: none;
}

.auth-slot {
  display: flex;
  align-items: center;
  min-width: 0;
}

.auth-login {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 13px 0 10px;
  border: 1px solid var(--header-line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--header-ink);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: var(--shadow-xs);
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    opacity 0.18s ease;
}

.auth-login:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
}

.auth-login.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.auth-google-icon {
  width: 16px;
  height: 16px;
  flex: none;
}

.auth-user {
  position: relative;
}

.auth-user-trigger {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 36px;
  padding: 0 9px 0 5px;
  border: 1px solid var(--header-line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--header-ink);
  font: inherit;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.auth-user-trigger:hover,
.auth-user-trigger[aria-expanded="true"] {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
}

.auth-avatar {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.auth-user-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: 120px;
  line-height: 1.15;
}

.auth-user-name {
  max-width: 120px;
  overflow: hidden;
  font-size: 11.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-user-role {
  color: var(--header-muted);
  font-size: 9px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.auth-chevron {
  width: 13px;
  height: 13px;
  flex: none;
  color: var(--header-muted);
}

.auth-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 70;
  width: 236px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.auth-menu[hidden] {
  display: none;
}

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

.auth-menu-name {
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
}

.auth-menu-email {
  color: var(--muted);
  font-size: 10.5px;
  overflow-wrap: anywhere;
}

.auth-menu-item {
  width: 100%;
  padding: 8px 9px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

.auth-menu-item:hover {
  background: var(--surface-2);
}

.auth-menu-item:disabled {
  opacity: 0.6;
  cursor: wait;
}

@media (max-width: 760px) {
  .auth-user-copy {
    display: none;
  }

  .auth-login span {
    display: none;
  }

  .auth-login {
    padding: 0 10px;
  }
}

.header-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border: 1px solid var(--header-line);
  border-radius: var(--radius-pill);
  color: var(--header-muted);
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
}

.header-power {
  position: relative;
  width: 70px;
  height: 30px;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: #9aa0a6;
  color: #ffffff;
  font: inherit;
  cursor: pointer;
  transition:
    background-color 0.18s ease,
    filter 0.18s ease,
    opacity 0.18s ease;
}

.header-power:hover:not(:disabled) {
  filter: brightness(1.06);
}

.header-power:disabled {
  cursor: wait;
  opacity: 0.75;
}

.header-power.is-on {
  background: #43a047;
}

.header-power.is-off {
  background: #e53935;
}

.header-power.is-busy {
  filter: saturate(0.82);
}

.header-power-label {
  position: absolute;
  top: 50%;
  left: 12px;
  z-index: 1;
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1;
  transform: translateY(-50%);
}

.header-power.is-off .header-power-label {
  right: 11px;
  left: auto;
}

.header-power-knob {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 3px;
  width: 22px;
  height: auto;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition:
    left 0.18s ease,
    opacity 0.18s ease;
}

.header-power.is-on .header-power-knob {
  left: calc(100% - 25px);
}

.header-power:not(.is-on):not(.is-off) .header-power-knob {
  opacity: 0;
}

.header-power:not(.is-on):not(.is-off) .header-power-label {
  right: auto;
  left: 50%;
  transform: translate(-50%, -50%);
}

.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--faint);
  box-shadow: 0 0 0 3px var(--surface-3);
  flex: none;
}

.status-dot.is-ok {
  background: var(--success);
  box-shadow: 0 0 0 3px var(--success-soft);
}

.status-dot.is-warn {
  background: var(--warning);
  box-shadow: 0 0 0 3px var(--warning-soft);
}

.status-dot.is-danger {
  background: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-soft);
}

.status-dot.is-idle {
  background: var(--faint);
  box-shadow: 0 0 0 3px var(--surface-3);
}

.status-dot.is-loading {
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  animation: pulse-dot 1.4s ease-in-out infinite;
}

/* ----------------------------------------------------------- API settings */
.api-dialog-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: clamp(18px, 3vw, 26px);
}

.api-dialog-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.api-dialog-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
  flex: none;
}

.api-dialog-icon svg {
  width: 17px;
  height: 17px;
}

.api-dialog-heading {
  min-width: 0;
  flex: 1;
}

.api-dialog-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.015em;
}

.api-dialog-copy {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.6;
}

.api-dialog-preview {
  padding: 10px 12px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.api-dialog-status {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.api-dialog-status.is-ok {
  border-color: transparent;
  background: var(--success-soft);
  color: var(--success);
}

.api-dialog-status.is-error {
  border-color: transparent;
  background: var(--danger-soft);
  color: var(--danger);
}

.api-dialog-status.is-warn {
  border-color: transparent;
  background: var(--warning-soft);
  color: var(--ink);
}

.api-dialog-preview strong {
  color: var(--ink);
  font-weight: 600;
}

.api-dialog-note {
  padding: 10px 12px;
  border-left: 2px solid var(--accent);
  background: var(--accent-soft);
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.6;
}

.api-dialog-note.is-warn {
  border-left-color: var(--warning);
  background: var(--warning-soft);
  color: var(--ink);
}

.api-dialog-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.api-dialog-actions .grow {
  flex: 1;
}

/* -------------------------------------------------------- settings trigger */
.settings-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--header-line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--header-ink);
  box-shadow: var(--shadow-xs);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.settings-trigger:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
}

.settings-trigger[aria-expanded="true"] {
  border-color: var(--accent-border);
  box-shadow: var(--shadow-sm);
}

.settings-trigger > svg:first-child {
  width: 17px;
  height: 17px;
  color: var(--accent);
  flex: none;
}

.theme-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--ink);
  text-align: left;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.theme-option:hover {
  background: var(--surface-2);
}

.theme-option.is-active {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.theme-option-index {
  width: 20px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 9.5px;
  flex: none;
}

.theme-option-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.theme-option-name {
  font-size: 12.5px;
  font-weight: 650;
}

.theme-option-desc {
  overflow: hidden;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.4;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.theme-option-swatches {
  display: inline-flex;
  flex: none;
}

.theme-option-swatches i {
  width: 13px;
  height: 13px;
  margin-left: -3px;
  border: 1.5px solid var(--surface);
  border-radius: 50%;
  background: var(--swatch);
}

.theme-option-check {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  color: var(--accent);
  flex: none;
}

.theme-option-check svg {
  width: 14px;
  height: 14px;
}

/* -------------------------------------------------------- settings sidebar */
.settings-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  width: var(--settings-width);
  max-width: 100vw;
  border-left: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  visibility: hidden;
  pointer-events: none;
  transition: transform 0.24s ease, visibility 0.24s ease;
}

body.settings-open .settings-sidebar {
  transform: translateX(0);
  visibility: visible;
  pointer-events: auto;
}

.settings-sidebar-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
}

.settings-sidebar-head .eyebrow {
  margin-bottom: 5px;
}

.settings-sidebar-head h2 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.settings-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  flex: none;
}

.settings-close:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}

.settings-close svg {
  width: 14px;
  height: 14px;
}

.settings-options {
  display: grid;
  gap: 5px;
  padding: 10px 12px 12px;
}

.settings-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.settings-option:hover {
  background: var(--surface-2);
}

.settings-option.is-active {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.settings-option-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--accent);
  flex: none;
}

.settings-option-aa {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.settings-option-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1;
}

.settings-option-copy strong {
  font-size: 12px;
  font-weight: 650;
}

.settings-option-copy small {
  color: var(--muted);
  font-size: 9.5px;
}

.settings-option-chevron {
  color: var(--faint);
  flex: none;
}

.settings-option.is-active .settings-option-chevron {
  color: var(--accent);
}

.settings-divider {
  height: 1px;
  margin: 0 14px;
  background: var(--line);
}

.settings-panel {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 16px 16px 0;
  overscroll-behavior: contain;
}

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

.settings-panel-head h3 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.settings-panel-head p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.55;
}

.settings-panel-head-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 7px;
  flex: none;
}

.appearance-switch {
  display: inline-flex;
  gap: 1px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface-2);
}

.appearance-switch .appearance-option {
  padding: 4px 7px;
  border: 0;
  border-radius: calc(var(--radius-pill) - 2px);
  background: transparent;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.appearance-switch .appearance-option:hover {
  color: var(--ink);
}

.appearance-switch .appearance-option.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-xs);
}

.font-size-list {
  display: grid;
  gap: 9px;
  min-width: 0;
  padding-bottom: 12px;
}

.font-size-row {
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-soft);
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}

.font-size-row.is-previewing {
  border-color: var(--accent-border);
  box-shadow: var(--focus);
}

.font-size-highlight {
  outline: 2px solid #ef4444 !important;
  outline-offset: 2px !important;
  background-color: color-mix(in srgb, var(--accent) 12%, transparent) !important;
  border-radius: 3px;
  transition: outline-color 0.12s ease, background-color 0.12s ease;
}

.font-size-row-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.font-size-row-copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.font-size-row-copy strong {
  font-size: 11.5px;
  font-weight: 650;
}

.font-size-row-copy small {
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.4;
}

.font-size-number {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: none;
}

.settings-sidebar .font-size-number-input {
  width: 64px;
  min-height: 0;
  height: 28px;
  padding: 3px 5px;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 11px;
}

.font-size-number > span {
  color: var(--faint);
  font-size: 9.5px;
}

.font-size-slider {
  width: 100%;
  margin: 10px 0 6px;
  accent-color: var(--accent);
  cursor: pointer;
}

.font-size-preview {
  min-width: 0;
  overflow: hidden;
  padding: 8px 9px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  line-height: 1.35;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.settings-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 -16px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.settings-actions .btn {
  flex: 1 1 auto;
  justify-content: center;
}

.settings-theme-list {
  display: grid;
  gap: 6px;
  padding-bottom: 16px;
}

.settings-theme-list .theme-option {
  position: relative;
  overflow: hidden;
  padding-top: 11px;
  border: 1px solid var(--header-line);
  border-radius: var(--radius-md);
  background-color: var(--bg);
  background-image: linear-gradient(var(--header-bg), var(--header-bg));
  box-shadow: var(--header-shadow);
  color: var(--header-ink);
}

.settings-theme-list .theme-option::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: var(--brand-bar);
  pointer-events: none;
}

.settings-theme-list .theme-option:hover {
  border-color: var(--line-strong);
  background-color: var(--bg);
  background-image: linear-gradient(var(--header-bg), var(--header-bg));
  box-shadow: var(--shadow-sm);
}

.settings-theme-list .theme-option.is-active {
  border-color: var(--accent-border);
  background-color: var(--bg);
  background-image: linear-gradient(var(--header-bg), var(--header-bg));
  box-shadow: var(--focus);
}

.settings-theme-list .theme-option-index {
  color: var(--header-muted);
}

.settings-theme-list .theme-option-name {
  color: var(--header-ink);
  font-family: var(--font-display);
}

.settings-theme-list .theme-option-desc {
  color: var(--header-muted);
}

.settings-theme-list .theme-option-active-preview {
  display: inline-flex;
  align-items: center;
  flex: none;
  justify-content: flex-start;
  gap: 4px;
  padding: 4px 8px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10px;
  font-weight: 650;
  line-height: 1.2;
  white-space: nowrap;
  pointer-events: none;
}

.settings-theme-list .theme-option[data-theme="nvidia"] .theme-option-active-preview,
.settings-theme-list .theme-option[data-theme="ibm"] .theme-option-active-preview {
  background: var(--accent);
  color: var(--accent-ink, #ffffff);
}

.settings-theme-list .theme-option[data-theme="linear"] .theme-option-active-preview {
  background: var(--surface-3);
  color: var(--ink);
}

.settings-theme-list .theme-option-active-preview svg {
  width: 11px;
  height: 11px;
  flex: none;
}

.settings-theme-list .theme-option-active-preview-badge {
  display: inline-grid;
  place-items: center;
  min-width: 13px;
  height: 13px;
  padding: 0 3px;
  border-radius: 999px;
  background: var(--warning);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 0 0 1.5px var(--header-bg, var(--bg));
}

.settings-theme-list .theme-option-swatches i {
  border-color: var(--bg);
}

.settings-theme-list .theme-option-check {
  color: var(--accent);
  opacity: 0;
}

.settings-theme-list .theme-option.is-active .theme-option-check {
  opacity: 1;
}

@media (max-width: 1100px) {
  :root {
    --settings-width: 340px;
  }
}

@media (max-width: 760px) {
  body.settings-open .app-shell {
    padding-right: 0;
  }

  body.settings-open .toast-region {
    right: 18px;
  }

  .settings-sidebar {
    width: 100vw;
    max-width: none;
  }

  .settings-sidebar-head {
    padding-top: calc(18px + env(safe-area-inset-top));
  }
}

/* --------------------------------------------------------- main & footer */
.app-main {
  flex: 1;
  width: 100%;
  padding: clamp(0px, 0.5vw, 6px) clamp(16px, 3vw, 40px) 64px;
  outline: none;
}

.page {
  width: 100%;
  max-width: var(--content-width);
  margin: 0 auto;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 22px;
  height: 1px;
  background: var(--accent);
}

.page-title {
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 2.8vw, 2.5rem);
  font-weight: var(--display-weight);
  letter-spacing: var(--display-tracking);
  line-height: 1.12;
  text-wrap: balance;
}

.page-subtitle {
  max-width: 720px;
  margin-top: 9px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}

.app-footer {
  padding: 30px clamp(16px, 3vw, 40px) 22px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  color: var(--faint);
  font-size: 11px;
}

.footer-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 32px;
  flex-wrap: wrap;
  max-width: var(--content-width);
  margin: 0 auto;
}

.footer-brand {
  max-width: 360px;
}

.footer-brand strong {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.06em;
}

.footer-brand p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.75;
}

.footer-links {
  display: flex;
  align-items: flex-start;
  gap: clamp(24px, 5vw, 64px);
  flex-wrap: wrap;
}

.footer-column {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 110px;
}

.footer-heading {
  margin-bottom: 2px;
  color: var(--ink);
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

.app-footer a:hover {
  color: var(--accent);
}

.footer-bottom {
  display: flex;
  align-items: center;
  gap: 8px 18px;
  flex-wrap: wrap;
  max-width: var(--content-width);
  margin: 24px auto 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 9.5px;
}

.footer-bottom span:first-child {
  color: var(--muted);
  font-family: var(--font-mono);
}

/* --------------------------------------------------------------- buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 8px 15px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease,
    transform 0.12s ease, box-shadow 0.16s ease;
}

.btn svg {
  width: 15px;
  height: 15px;
  flex: none;
}

.btn:hover {
  background: var(--surface-3);
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--action-bg);
  color: var(--action-ink);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--action-bg-hover);
  color: var(--action-ink);
}

.btn-accent {
  background: var(--accent);
  color: var(--accent-ink);
}

.btn-accent:hover {
  background: var(--accent-hover);
  color: var(--accent-ink);
}

.btn-secondary {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--ink);
}

.btn-secondary:hover {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  color: var(--accent);
}

.btn-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.btn-sm {
  min-height: 30px;
  padding: 5px 10px;
  font-size: 11.5px;
}

.btn-lg {
  min-height: 48px;
  padding: 12px 22px;
  font-size: 14px;
}

.btn-icon {
  width: 34px;
  min-height: 34px;
  padding: 0;
}

.btn.is-loading {
  pointer-events: none;
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex: none;
}

/* ----------------------------------------------------------------- forms */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.field-label .field-tag {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 0.08em;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 38px;
  padding: 8px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: 12.5px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.input::placeholder,
.textarea::placeholder {
  color: var(--faint);
}

.input:hover,
.select:hover,
.textarea:hover {
  border-color: var(--muted);
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus);
}

.textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.6;
}

.select {
  appearance: none;
  padding-right: 32px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 16px, calc(100% - 11px) 16px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.field-help {
  color: var(--faint);
  font-size: 10.5px;
  line-height: 1.5;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.checkbox-field {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
}

.checkbox-field:hover {
  border-color: var(--line-strong);
}

.checkbox-field input {
  width: 15px;
  height: 15px;
  margin: 2px 0 0;
  accent-color: var(--accent);
  flex: none;
}

.checkbox-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.checkbox-copy strong {
  font-size: 11.5px;
  font-weight: 600;
}

.checkbox-copy span {
  color: var(--faint);
  font-size: 10px;
}

.multi-select {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.multi-option {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 5px;
  border-radius: var(--radius-xs);
  color: var(--muted);
  font-size: 10.5px;
  cursor: pointer;
}

.multi-option:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.multi-option input {
  width: 13px;
  height: 13px;
  accent-color: var(--accent);
  flex: none;
}

/* ---------------------------------------------------------------- badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  line-height: 1.5;
  white-space: nowrap;
}

.badge .status-dot {
  width: 5px;
  height: 5px;
  box-shadow: none;
}

.badge-neutral {
  border-color: var(--line);
  background: var(--surface-2);
  color: var(--muted);
}

.badge-info {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  color: var(--accent);
}

.badge-reuse {
  border-color: color-mix(in srgb, var(--info) 35%, transparent);
  background: color-mix(in srgb, var(--info) 14%, transparent);
  color: var(--info);
}

.badge-reuse-outline {
  border-color: color-mix(in srgb, var(--info) 35%, transparent);
  background: transparent;
  color: var(--info);
}

.badge-embed {
  border-color: color-mix(in srgb, #a78bfa 35%, transparent);
  background: color-mix(in srgb, #a78bfa 14%, transparent);
  color: #a78bfa;
}

.badge-embed-outline {
  border-color: color-mix(in srgb, #a78bfa 35%, transparent);
  background: transparent;
  color: #a78bfa;
}

.badge-ok {
  border-color: transparent;
  background: var(--success-soft);
  color: var(--success);
}

.badge-warn {
  background: var(--warning-soft);
  color: var(--warning);
}

.badge-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge-mono {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* ---------------------------------------------------------------- notices */
.notice {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 13px 15px;
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  color: var(--ink);
  font-size: 12px;
  line-height: 1.65;
}

.notice-icon {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  flex: none;
}

.notice-body {
  min-width: 0;
}

.notice-body strong {
  display: block;
  margin-bottom: 2px;
  font-size: 12px;
}

.notice-body p {
  color: var(--muted);
  font-size: 11.5px;
}

.notice-info {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.notice-info .notice-icon {
  background: var(--accent);
  color: var(--accent-ink);
}

.notice-ok {
  border-color: transparent;
  background: var(--success-soft);
}

.notice-ok .notice-icon {
  background: var(--success);
  color: #ffffff;
}

.notice-warn {
  border-color: transparent;
  background: var(--warning-soft);
}

.notice-warn .notice-icon {
  background: var(--warning);
  color: #ffffff;
}

.notice-danger {
  border-color: transparent;
  background: var(--danger-soft);
}

.notice-danger .notice-icon {
  background: var(--danger);
  color: #ffffff;
}

/* ----------------------------------------------------------------- cards */
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.card-pad {
  padding: clamp(16px, 2.2vw, 24px);
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.section-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.section-sub {
  color: var(--faint);
  font-size: 11px;
}

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

.metric-card {
  padding: 16px 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.metric-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--faint);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.metric-value {
  margin-top: 7px;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 2vw, 1.8rem);
  font-weight: var(--display-weight);
  letter-spacing: var(--display-tracking);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.metric-foot {
  margin-top: 5px;
  color: var(--muted);
  font-size: 10.5px;
}

/* --------------------------------------------------------- data quality */
.quality-checks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.quality-check {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
}

.quality-check.is-ok {
  border-left-color: var(--success);
}

.quality-check.is-danger {
  border-left-color: var(--danger);
}

.quality-check.is-warn {
  border-left-color: var(--warning);
}

.quality-check.is-info {
  border-left-color: var(--info);
}

.quality-check-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.quality-check-label {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 10.5px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quality-check-value {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-top: 6px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.quality-check-value strong {
  font-size: 15px;
  font-weight: 700;
}

.quality-check-value span {
  color: var(--faint);
  font-size: 9px;
}

.quality-check-value em {
  margin-left: auto;
  color: var(--faint);
  font-size: 9px;
  font-style: normal;
}

.quality-check-desc {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.5;
}

.quality-check-track {
  height: 4px;
  margin-top: 7px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--surface-2);
}

.quality-check-track span {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: var(--success);
}

.quality-check.is-danger .quality-check-track span {
  background: var(--danger);
}

.quality-check.is-warn .quality-check-track span {
  background: var(--warning);
}

.quality-check.is-info .quality-check-track span {
  background: var(--info);
}

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

.quality-archive-table .cell-jid {
  max-width: 260px;
  white-space: normal;
}

.quality-archive-table .cell-jid .chip {
  margin-left: 6px;
}

@media (max-width: 980px) {
  .quality-checks,
  .quality-dist-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .quality-coverage-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ------------------------------------------------------------ empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(36px, 6vw, 72px) 24px;
  text-align: center;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  color: var(--faint);
}

.empty-icon svg {
  width: 24px;
  height: 24px;
}

.empty-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.empty-text {
  max-width: 440px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.empty-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
  justify-content: center;
}

/* ----------------------------------------------------------------- chips */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--chip-bg);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 500;
}

button.chip {
  transition: border-color 0.16s ease, color 0.16s ease, background 0.16s ease;
}

button.chip:hover {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  color: var(--accent);
}

.chip .status-dot {
  width: 5px;
  height: 5px;
  box-shadow: none;
}

/* ----------------------------------------------------------------- toast */
.toast-region {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 160;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(360px, calc(100vw - 36px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  font-size: 12px;
  line-height: 1.55;
  pointer-events: auto;
  animation: toast-in 0.22s ease;
}

.toast.is-leaving {
  animation: toast-out 0.18s ease forwards;
}

.toast-mark {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 10px;
  font-weight: 700;
  flex: none;
}

.toast-ok .toast-mark {
  background: var(--success);
  color: #ffffff;
}

.toast-warn .toast-mark {
  background: var(--warning);
  color: #ffffff;
}

.toast-danger .toast-mark {
  background: var(--danger);
  color: #ffffff;
}

.toast-body {
  min-width: 0;
  flex: 1;
}

.toast-close {
  border: 0;
  background: transparent;
  color: var(--faint);
  font-size: 15px;
  line-height: 1;
  padding: 2px;
}

/* -------------------------------------------------------------- skeleton */
.skeleton {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.skeleton-title {
  width: min(420px, 70%);
  height: 38px;
  margin-bottom: 12px;
}

.skeleton-subtitle {
  width: min(620px, 90%);
  height: 16px;
  margin-bottom: 28px;
}

.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.skeleton-card {
  height: 168px;
  border-radius: var(--radius-lg);
}

.skeleton-line {
  height: 12px;
  margin-bottom: 10px;
}

.page-loading {
  max-width: var(--content-width);
  margin: 0 auto;
}

/* ------------------------------------------------------------------ home */
.home-page {
  padding-top: clamp(8px, 1.4vw, 18px);
}

.home-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
  align-items: stretch;
  gap: clamp(24px, 4vw, 56px);
  padding: clamp(28px, 4.5vw, 58px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: clamp(24px, 3vw, 40px);
  background:
    radial-gradient(
      110% 90% at 12% -18%,
      color-mix(in srgb, var(--accent) 13%, transparent) 0%,
      transparent 56%
    ),
    radial-gradient(
      70% 70% at 96% 108%,
      color-mix(in srgb, var(--accent) 7%, transparent) 0%,
      transparent 62%
    ),
    linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  box-shadow: var(--shadow-sm);
}

.home-hero::before {
  content: "";
  position: absolute;
  top: -42%;
  left: 12%;
  width: min(720px, 80vw);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    color-mix(in srgb, var(--accent) 16%, transparent) 0%,
    transparent 68%
  );
  filter: blur(10px);
  pointer-events: none;
}

.home-hero-copy {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.home-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  align-self: flex-start;
  padding: 7px 14px;
  border: 1px solid color-mix(in srgb, var(--ink) 10%, transparent);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.home-eyebrow::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent);
}

.home-title {
  max-width: 880px;
  margin-top: clamp(20px, 2.8vw, 32px);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(2.65rem, 5.4vw, 4.8rem);
  font-weight: var(--display-weight);
  letter-spacing: -0.05em;
  line-height: 1.03;
  text-wrap: balance;
}

.home-title span {
  display: block;
  color: var(--accent);
}

@supports (-webkit-background-clip: text) {
  .home-title span {
    background: linear-gradient(
      100deg,
      var(--accent) 0%,
      color-mix(in srgb, var(--accent) 52%, var(--ink)) 58%,
      var(--ink) 100%
    );
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }
}

.home-lead {
  max-width: 700px;
  margin-top: clamp(16px, 2vw, 24px);
  color: var(--muted);
  font-size: clamp(13.5px, 1.25vw, 16px);
  line-height: 1.85;
  text-wrap: pretty;
}

.home-ask {
  width: min(720px, 100%);
  margin-top: clamp(24px, 3vw, 36px);
  text-align: left;
}

.home-ask-box {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 8px 8px 18px;
  border: 1px solid color-mix(in srgb, var(--ink) 12%, transparent);
  border-radius: clamp(18px, 2.4vw, 26px);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.home-ask-box:focus-within {
  border-color: var(--accent-border);
  box-shadow:
    var(--shadow-md),
    0 0 0 4px var(--accent-soft);
}

.home-ask-input {
  flex: 1;
  min-width: 0;
  min-height: 54px;
  max-height: 180px;
  padding: 13px 4px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: clamp(14px, 1.25vw, 15.5px);
  line-height: 1.65;
  outline: none;
  resize: none;
}

.home-ask-input::placeholder {
  color: var(--faint);
}

.home-ask-submit {
  flex: none;
  min-height: 48px;
  padding: 0 20px;
  border-radius: 999px;
}

.home-ask-help {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px 18px;
  flex-wrap: wrap;
  padding: 11px 4px 0;
  color: var(--faint);
  font-size: 10.5px;
}

.home-ask-help kbd {
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9.5px;
}

.home-hero-meta {
  display: flex;
  align-items: center;
  gap: 10px 20px;
  flex-wrap: wrap;
  margin-top: 20px;
  color: var(--faint);
  font-size: 11px;
}

.home-hero-meta > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.home-live-card {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-self: center;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--line));
  border-radius: clamp(20px, 2.6vw, 28px);
  background:
    linear-gradient(
      160deg,
      color-mix(in srgb, var(--accent) 7%, var(--surface)) 0%,
      var(--surface) 46%,
      var(--surface) 100%
    );
  box-shadow: var(--shadow-md);
}

.home-live-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--line);
}

.home-live-kicker {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.home-live-refresh {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    color 0.15s ease,
    transform 0.15s ease;
}

.home-live-refresh:hover {
  border-color: var(--accent-border);
  color: var(--accent);
}

.home-live-refresh.is-loading svg {
  animation: home-spin 0.9s linear infinite;
}

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

.home-live-rows {
  display: flex;
  flex-direction: column;
}

.home-live-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
}

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

.home-live-label {
  flex: none;
  color: var(--muted);
  font-size: 11px;
}

.home-live-value {
  min-width: 0;
  color: var(--ink);
  font-size: clamp(14px, 1.5vw, 17px);
  font-weight: 650;
  text-align: right;
  overflow-wrap: anywhere;
}

.home-live-value i {
  color: var(--faint);
  font-style: normal;
  font-weight: 400;
}

.home-live-rows.is-loading {
  gap: 12px;
  padding: 16px;
}

.home-live-rows.is-loading .skeleton-line {
  margin: 0;
}

.home-live-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  flex-wrap: wrap;
  padding: 12px 16px 14px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 9px;
  line-height: 1.5;
}

.home-live-source {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.home-live-time {
  font-family: var(--font-mono);
}

.home-live-error {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 18px 16px;
}

.home-live-error-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 9px;
  background: var(--warning-soft);
  color: var(--warning);
}

.home-live-error strong {
  display: block;
  color: var(--ink);
  font-size: 12px;
}

.home-live-error p {
  margin: 4px 0 10px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.home-section {
  margin-top: clamp(60px, 8vw, 104px);
}

.home-section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px 44px;
  flex-wrap: wrap;
  margin-bottom: clamp(22px, 3vw, 32px);
}

.home-kicker {
  display: block;
  margin-bottom: 9px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.home-section-head h2 {
  max-width: 820px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 3.3vw, 2.8rem);
  font-weight: var(--display-weight);
  letter-spacing: var(--display-tracking);
  line-height: 1.08;
  text-wrap: balance;
}

.home-section-head > p {
  max-width: 390px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.75;
  text-wrap: pretty;
}

.processing-summary.home-metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

.home-metric-group {
  display: contents;
}

.home-metric-grid .processing-summary-card {
  gap: 5px;
  padding: 15px 16px;
  border-radius: var(--radius-md);
  background:
    linear-gradient(
      160deg,
      color-mix(in srgb, var(--accent) 5%, var(--surface)) 0%,
      var(--surface) 58%
    );
}

.home-metric-grid .processing-summary-value {
  font-size: clamp(17px, 2.1vw, 23px);
}

.home-metric-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.home-fact {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.home-fact.is-loading {
  min-height: 76px;
}

.home-fact-label {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.home-fact strong {
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: clamp(17px, 2vw, 22px);
  font-weight: 650;
  line-height: 1.2;
}

.home-fact small {
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.home-rag-flow {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  list-style: none;
}

.home-rag-step {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  min-width: 0;
  padding: 14px 13px;
  border-right: 1px solid var(--line);
}

.home-rag-step:last-child {
  border-right: 0;
}

.home-rag-step-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--line));
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent);
}

.home-rag-step-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.home-rag-step-copy small {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 8px;
  line-height: 1.2;
}

.home-rag-step-copy strong {
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 650;
  line-height: 1.3;
}

.home-rag-step-copy > span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.home-rag-values {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.home-rag-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
  overflow: hidden;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(
      120% 100% at 100% 0%,
      color-mix(in srgb, var(--accent) 7%, transparent) 0%,
      transparent 58%
    ),
    var(--surface);
}

.home-rag-card.is-loading {
  min-height: 210px;
}

.home-rag-kicker {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.home-rag-value {
  color: var(--ink);
  font-size: clamp(1.45rem, 2.6vw, 2.1rem);
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.home-rag-value small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0;
}

.home-rag-label {
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.4;
}

.home-rag-progress {
  display: block;
  height: 6px;
  margin-top: 2px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-3);
}

.home-rag-progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(
    90deg,
    var(--accent) 0%,
    color-mix(in srgb, var(--accent) 55%, var(--ink)) 100%
  );
}

.home-rag-meta {
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.home-rag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.home-chip {
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8.5px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.home-chip.is-on {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  color: var(--accent);
}

.home-rag-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: auto;
  padding-top: 8px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 650;
  text-decoration: none;
}

.home-rag-link:hover {
  gap: 7px;
}

.home-rag-error,
.home-source-error,
.home-laws-error,
.home-wf-error-body {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.6;
}

.home-rag-values > .home-rag-error {
  grid-column: 1 / -1;
}

.home-trace {
  margin-top: 12px;
  padding: 15px 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
}

.home-trace-row {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  padding: 7px 0;
}

.home-trace-row + .home-trace-row {
  border-top: 1px dashed var(--line);
}

.home-trace-label {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 9px;
  line-height: 1.8;
}

.home-trace-path {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  color: var(--faint);
  font-size: 9.5px;
}

.home-trace-node {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  line-height: 1.3;
}

.home-trace-node.is-link {
  color: var(--accent);
  text-decoration: none;
}

.home-trace-node.is-link:hover {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.home-trace-note {
  margin: 8px 0 0;
  color: var(--faint);
  font-size: 9.5px;
  line-height: 1.65;
}

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

.home-source-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.home-source-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.home-source-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border: 1px solid color-mix(in srgb, var(--accent) 20%, var(--line));
  border-radius: 11px;
  background: var(--accent-soft);
  color: var(--accent);
}

.home-source-head > div {
  flex: 1;
  min-width: 0;
}

.home-source-head strong {
  display: block;
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.35;
}

.home-source-head small {
  display: block;
  margin-top: 2px;
  color: var(--faint);
  font-size: 9px;
  line-height: 1.4;
}

.home-source-link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex: none;
  color: var(--accent);
  font-size: 9.5px;
  font-weight: 600;
  text-decoration: none;
}

.home-source-copy {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.7;
}

.home-source-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin: 12px 0 0;
}

.home-source-facts > div {
  min-width: 0;
  padding: 7px 9px;
  border-radius: var(--radius-xs);
  background: var(--surface-2);
}

.home-source-facts dt {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.home-source-facts dd {
  margin: 2px 0 0;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.home-source-flow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: auto;
  padding-top: 12px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 8.5px;
}

.home-source-flow span {
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--muted);
}

.home-laws {
  margin-top: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.home-laws-summary {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  cursor: pointer;
  list-style: none;
}

.home-laws-summary::-webkit-details-marker {
  display: none;
}

.home-laws-summary:focus-visible {
  outline: 2px solid var(--accent-border);
  outline-offset: -2px;
}

.home-laws-count {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  flex: none;
  border: 1px solid var(--accent-border);
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
}

.home-laws-title {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.home-laws-title strong {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.home-laws-title small {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9.5px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.home-laws-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  color: var(--accent);
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}

.home-laws-toggle svg {
  transition: transform 0.2s ease;
}

.home-laws[open] .home-laws-toggle svg {
  transform: rotate(180deg);
}

.home-laws-body {
  padding: 14px 18px 18px;
  border-top: 1px solid var(--line);
}

.home-laws-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  color: var(--faint);
  font-size: 9.5px;
  line-height: 1.5;
}

.home-laws-toolbar > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.home-laws-grid {
  display: grid;
  grid-template-columns: repeat(var(--home-law-columns, 11), minmax(0, 1fr));
  gap: 5px;
}

.home-law {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 6px 5px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
}

.home-law-index {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 7.5px;
  line-height: 1;
}

.home-law-name {
  color: var(--ink);
  font-size: clamp(8px, 0.8vw, 10.5px);
  line-height: 1.35;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.home-laws-empty {
  margin: 0;
  padding: 18px;
  color: var(--muted);
  font-size: 11px;
}

.home-laws-loading {
  min-height: 88px;
  margin-top: 12px;
  border-radius: var(--radius-lg);
}

.status-wf-card.home-wf-card {
  margin-top: 0;
}

.home-wf-links {
  display: flex;
  align-items: center;
  gap: 6px 12px;
  flex-wrap: wrap;
  margin-left: auto;
}

.home-wf-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.home-wf-link:hover {
  gap: 7px;
}

.home-wf-metrics {
  margin: 12px 16px 0;
}

.home-wf-step {
  margin-right: 4px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 8.5px;
}

.home-wf-slow {
  display: inline-flex;
  align-items: center;
  margin-left: 4px;
  padding: 1px 5px;
  border-radius: 999px;
  background: var(--warning-soft);
  color: var(--warning);
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 700;
  vertical-align: middle;
}

.home-wf-stage.is-slowest .rag-wf-stage-meta {
  color: var(--warning);
}

.home-wf-stage.is-slowest .rag-wf-track {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--warning) 34%, transparent);
}

.home-wf-loading-label {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 9.5px;
}

.home-wf-loading-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px 16px;
}

.home-wf-loading-body .skeleton-line {
  margin: 0;
}

.home-wf-error-body {
  margin: 14px 16px 16px;
}

.home-wf-card .status-wf-chart .rag-wf-axis {
  padding-top: 12px;
}

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

.home-tile {
  --tile-tint: var(--accent);
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 218px;
  padding: clamp(18px, 2.1vw, 26px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: clamp(20px, 2.4vw, 28px);
  background:
    radial-gradient(
      120% 90% at 100% 0%,
      color-mix(in srgb, var(--tile-tint) 10%, transparent) 0%,
      transparent 55%
    ),
    var(--surface);
  color: var(--ink);
  text-decoration: none;
  transition:
    transform 0.25s ease,
    border-color 0.25s ease,
    box-shadow 0.25s ease;
}

.home-tile.is-wide {
  grid-column: span 2;
  min-height: 238px;
  background:
    radial-gradient(
      100% 120% at 100% 0%,
      color-mix(in srgb, var(--tile-tint) 18%, transparent) 0%,
      transparent 58%
    ),
    var(--surface);
}

.home-tile:hover {
  color: var(--ink);
  border-color: color-mix(in srgb, var(--tile-tint) 36%, var(--line));
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.home-tile.tone-blue {
  --tile-tint: #0a84ff;
}

.home-tile.tone-green {
  --tile-tint: #30d158;
}

.home-tile.tone-amber {
  --tile-tint: #ff9f0a;
}

.home-tile.tone-violet {
  --tile-tint: #bf5af2;
}

.home-tile.tone-slate {
  --tile-tint: #5ac8fa;
}

.home-tile.tone-rose {
  --tile-tint: #ff375f;
}

.home-tile-watermark {
  position: absolute;
  right: -24px;
  bottom: -28px;
  width: 152px;
  height: 152px;
  color: var(--tile-tint);
  opacity: 0.07;
  pointer-events: none;
}

.home-tile-watermark svg {
  width: 100%;
  height: 100%;
}

.home-tile-head {
  display: flex;
  align-items: center;
  gap: 11px;
}

.home-tile-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid color-mix(in srgb, var(--tile-tint) 24%, transparent);
  border-radius: 12px;
  background: color-mix(in srgb, var(--tile-tint) 11%, transparent);
  color: var(--tile-tint);
}

.home-tile-kicker {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.home-tile-copy {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 22px;
}

.home-tile-copy strong {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 1.8vw, 1.55rem);
  font-weight: var(--display-weight);
  letter-spacing: var(--display-tracking);
  line-height: 1.2;
}

.home-tile-copy > span {
  max-width: 330px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.home-tile-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 22px;
}

.home-tile-metric {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.04em;
  overflow-wrap: anywhere;
}

.home-tile-cta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: none;
  color: var(--tile-tint);
  font-size: 11.5px;
  font-weight: 650;
  white-space: nowrap;
  transition: gap 0.2s ease;
}

.home-tile:hover .home-tile-cta {
  gap: 7px;
}

.home-trust {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(24px, 4vw, 56px);
  margin-top: clamp(60px, 8vw, 104px);
  padding: clamp(34px, 4.5vw, 56px) 0 clamp(8px, 2vw, 18px);
  border-top: 1px solid var(--line);
}

.home-trust-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
}

.home-trust-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--accent);
}

.home-trust-item strong {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.home-trust-item p {
  max-width: 340px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.75;
}

@media (max-width: 1100px) {
  .home-hero {
    grid-template-columns: minmax(0, 1fr);
  }

  .home-live-card {
    max-width: 620px;
  }

  .home-rag-flow {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .home-rag-step:nth-child(3n) {
    border-right: 0;
  }

  .home-rag-step:nth-child(n + 4) {
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 1024px) {
  .processing-summary.home-metric-grid,
  .home-metric-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-rag-values {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-tile-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-tile.is-wide {
    grid-column: span 2;
  }
}

@media (max-width: 820px) {
  .home-section-head {
    align-items: flex-start;
  }

  .home-section-head > p {
    max-width: 560px;
  }

  .home-source-grid,
  .home-rag-values {
    grid-template-columns: minmax(0, 1fr);
  }

  .home-trust {
    grid-template-columns: 1fr;
    gap: 28px;
  }
}

@media (max-width: 720px) {
  .home-ask-box {
    flex-direction: column;
    align-items: stretch;
    padding: 10px;
  }

  .home-ask-input {
    min-height: 48px;
    padding: 8px 10px;
  }

  .home-ask-submit {
    width: 100%;
  }

  .home-rag-flow {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-rag-step:nth-child(3n) {
    border-right: 1px solid var(--line);
  }

  .home-rag-step:nth-child(2n) {
    border-right: 0;
  }

  .home-rag-step:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }

  .home-tile-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .home-tile.is-wide {
    grid-column: auto;
  }

  .home-tile {
    min-height: 198px;
  }

  .home-trace-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }

  .home-wf-links {
    width: 100%;
    margin-left: 0;
  }
}

@media (max-width: 640px) {
  .processing-summary.home-metric-grid,
  .home-metric-strip {
    grid-template-columns: minmax(0, 1fr);
  }

  .home-hero {
    padding: 22px 18px 24px;
    border-radius: 24px;
  }

  .home-eyebrow {
    font-size: 8.5px;
    letter-spacing: 0.11em;
  }

  .home-title {
    font-size: clamp(2.25rem, 10.6vw, 2.8rem);
  }

  .home-hero-meta {
    gap: 8px 14px;
    font-size: 10px;
  }

  .home-section {
    margin-top: 56px;
  }

  .home-wf-metrics {
    margin: 10px 12px 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-wf-card .status-wf-chart .rag-wf-axis,
  .home-wf-card .status-wf-chart .rag-wf-stages,
  .home-wf-card .status-wf-chart .rag-wf-hint {
    padding-left: 12px;
    padding-right: 12px;
  }

  .home-wf-card .rag-wf-stage-head {
    flex-wrap: wrap;
  }

  .home-wf-card .rag-wf-stage-meta {
    justify-content: flex-start;
    white-space: normal;
  }

  .home-laws-summary {
    gap: 10px;
    padding: 13px 12px;
  }

  .home-laws-count {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    font-size: 17px;
  }

  .home-laws-title strong {
    font-size: 13px;
  }

  .home-laws-toggle > span {
    display: none;
  }

  .home-laws-body {
    padding: 12px;
  }

  .home-laws-grid {
    gap: 3px;
  }

  .home-law {
    padding: 4px 3px;
    border-radius: 4px;
  }

  .home-law-index {
    font-size: 6.5px;
  }

  .home-law-name {
    font-size: 7.5px;
    line-height: 1.3;
  }
}

@media (max-width: 480px) {
  .home-hero {
    padding: 20px 14px 22px;
  }

  .home-live-row {
    padding: 10px 14px;
  }

  .home-live-foot {
    padding: 11px 14px 13px;
  }

  .home-rag-step {
    gap: 7px;
    padding: 12px 10px;
  }

  .home-rag-step-icon {
    width: 28px;
    height: 28px;
  }

  .home-source-card {
    padding: 15px;
  }

  .home-source-facts {
    gap: 5px;
  }
}

/* ------------------------------------------------------------------- RAG */
.rag-hero {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(12px, 3vw, 34px) 0 clamp(26px, 4vw, 44px);
  text-align: center;
}

.rag-hero .eyebrow {
  margin-bottom: 14px;
}

.rag-hero .eyebrow::before {
  display: none;
}

.rag-hero-compact {
  padding-top: clamp(6px, 1.4vw, 14px);
  padding-bottom: clamp(18px, 3vw, 30px);
}

.rag-hero-compact .rag-mode-card {
  margin-top: 0;
}

.rag-title {
  max-width: 900px;
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 4.4vw, 3.5rem);
  font-weight: var(--display-weight);
  letter-spacing: var(--display-tracking);
  line-height: 1.08;
  text-wrap: balance;
}

.rag-lead {
  max-width: 680px;
  margin-top: 16px;
  color: var(--muted);
  font-size: clamp(13px, 1.35vw, 15px);
  line-height: 1.8;
}

.rag-hero .notice {
  max-width: 780px;
  margin-top: 20px;
  text-align: left;
}

.rag-mode-card {
  width: min(780px, 100%);
  margin-top: 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  text-align: left;
}

.rag-mode-head {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  flex-wrap: wrap;
  padding: 14px 16px;
  background: var(--accent-soft);
}

.rag-mode-card.is-ok .rag-mode-head {
  background: var(--success-soft);
}

.rag-mode-card.is-warn .rag-mode-head {
  background: var(--warning-soft);
}

.rag-mode-icon {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin-top: 1px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  flex: none;
}

.rag-mode-card.is-ok .rag-mode-icon {
  background: var(--success);
  color: #ffffff;
}

.rag-mode-card.is-warn .rag-mode-icon {
  background: var(--warning);
  color: #ffffff;
}

.rag-mode-copy {
  min-width: 0;
  flex: 1;
}

.rag-mode-copy strong {
  display: block;
  margin-bottom: 2px;
  color: var(--ink);
  font-size: 12px;
}

.rag-mode-copy p {
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.6;
}

.rag-mode-head .badge {
  flex: none;
  margin-left: auto;
}

.rag-model-strip {
  padding: 12px 16px 14px;
}

.rag-model-strip-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.rag-model-strip-title {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
}

.rag-model-strip-base {
  max-width: 220px;
  overflow: hidden;
  color: var(--faint);
  font-size: 8.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rag-model-strip-current {
  margin-left: auto;
  color: var(--faint);
  font-size: 9px;
}

.rag-model-strip-current strong {
  color: var(--muted);
  font-family: var(--font-mono);
  font-weight: 500;
}

.rag-model-refresh {
  flex: none;
}

.rag-model-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.rag-model-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--success-soft);
  border-radius: var(--radius-pill);
  background: var(--success-soft);
  color: var(--success);
  cursor: pointer;
  font-size: 10px;
  font-weight: 650;
  transition: background 0.15s ease, border-color 0.15s ease,
    color 0.15s ease;
}

.rag-model-button:hover:not(:disabled) {
  border-color: var(--success);
}

.rag-model-button.is-active {
  border-color: var(--success);
  background: var(--success);
  color: #ffffff;
}

.rag-model-button:disabled {
  cursor: wait;
}

.rag-model-button.is-static {
  cursor: default;
}

.rag-model-button.is-static:hover {
  border-color: var(--success-soft);
}

.rag-model-button.is-static.is-active:hover {
  border-color: var(--success);
}

.rag-model-button.is-unavailable {
  border-color: var(--line);
  background: var(--surface-2);
  color: var(--faint);
}

.rag-model-button.is-unavailable .rag-model-state {
  background: var(--faint);
}

.rag-model-button.is-static.is-unavailable:hover {
  border-color: var(--line);
}

.rag-model-strip-rerank {
  border-top: 1px solid var(--line);
}

.rag-model-state {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

.rag-model-current {
  color: currentColor;
  font-family: var(--font-mono);
  font-size: 8px;
  opacity: 0.8;
}

.rag-model-hint,
.rag-model-empty {
  margin-top: 7px;
  color: var(--faint);
  font-size: 9px;
  line-height: 1.55;
}

.rag-model-empty {
  color: var(--muted);
  font-size: 10.5px;
}

.ask-card {
  width: min(860px, 100%);
  margin-top: 26px;
  padding: 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  text-align: left;
}

.ask-card:focus-within {
  border-color: var(--accent-border);
  box-shadow: var(--shadow-md), var(--focus);
}

.ask-input {
  width: 100%;
  min-height: 88px;
  max-height: 240px;
  padding: 14px 16px 6px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  resize: none;
}

.ask-input:focus {
  outline: none;
}

.ask-input::placeholder {
  color: var(--faint);
}

.ask-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 8px 4px 14px;
}

.ask-hints {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--faint);
  font-size: 10px;
}

.ask-hints kbd {
  padding: 2px 5px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 9px;
}

.ask-submit {
  min-height: 42px;
  padding: 10px 20px;
}

.example-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
  margin-top: 18px;
  max-width: 860px;
}

.example-chip {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  transition: border-color 0.16s ease, color 0.16s ease, background 0.16s ease;
}

.example-chip:hover {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  color: var(--accent);
}

/* --------------------------------------------------------- rag library */
.rag-layout {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.rag-workspace {
  min-width: 0;
}

.rag-library {
  position: sticky;
  top: 86px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: calc(100vh - 104px);
  padding: 10px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  scrollbar-width: thin;
}

.rag-library::-webkit-scrollbar {
  width: 5px;
}

.rag-library::-webkit-scrollbar-thumb {
  border-radius: var(--radius-pill);
  background: var(--line-strong);
}

.rag-new-chat {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-ink, #fff);
  text-align: left;
  transition: background 0.16s ease, border-color 0.16s ease;
}

.rag-new-chat:hover {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
}

.rag-new-chat-mark {
  display: grid;
  place-items: center;
  flex: none;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
}

.rag-new-chat-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.rag-new-chat-copy strong {
  font-size: 12px;
  font-weight: 600;
}

.rag-new-chat-copy small {
  color: currentColor;
  font-size: 9px;
  opacity: 0.72;
}

.rag-library-context {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-xs);
  background: var(--accent-soft);
  color: var(--muted);
  font-size: 9.5px;
}

.rag-library-context > span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 1;
  min-width: 0;
}

.rag-library-context strong {
  overflow: hidden;
  color: var(--accent);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rag-library-context button {
  flex: none;
  padding: 2px;
  border: 0;
  background: transparent;
  color: var(--faint);
  line-height: 1;
}

.rag-library-context button:hover {
  color: var(--ink);
}

.rag-library-section {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.rag-library-head {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 6px 7px;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  text-align: left;
}

.rag-library-head:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.rag-library-head.is-static {
  cursor: default;
}

.rag-library-head.is-static:hover {
  background: transparent;
  color: var(--muted);
}

.rag-library-head .btn {
  padding: 2px 6px;
  font-size: 9px;
}

.rag-library-title {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 1;
  min-width: 0;
}

.rag-library-count {
  min-width: 18px;
  padding: 0 5px;
  border-radius: var(--radius-pill);
  background: var(--surface-3);
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 500;
  line-height: 16px;
  text-align: center;
}

.rag-library-chevron {
  flex: none;
  transition: transform 0.16s ease;
}

.rag-library-section.is-collapsed .rag-library-chevron {
  transform: rotate(-90deg);
}

.rag-library-section.is-collapsed .rag-library-body {
  display: none;
}

.rag-library-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 1px 0 3px;
}

.rag-library-empty {
  padding: 7px 7px 8px;
  color: var(--faint);
  font-size: 9.5px;
  line-height: 1.55;
}

.rag-library-foot {
  margin-top: 3px;
  padding: 6px 7px 2px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 8.5px;
  line-height: 1.5;
}

.rag-history-item {
  display: flex;
  align-items: flex-start;
  gap: 1px;
  border-radius: var(--radius-xs);
}

.rag-history-item:hover {
  background: var(--surface-2);
}

.rag-history-item.is-active {
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent);
}

.rag-history-item.is-active:hover {
  background: var(--accent-soft);
}

.rag-history-item.is-active .history-question {
  color: var(--accent);
  font-weight: 650;
}

.rag-history-item.is-active .history-meta {
  color: var(--accent);
}

.rag-history-actions {
  display: flex;
  align-items: flex-start;
  flex: none;
  color: var(--ink);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
}

.rag-history-item:hover .rag-history-actions,
.rag-history-item:focus-within .rag-history-actions {
  opacity: 1;
  visibility: visible;
}

.rag-history-item.is-active .rag-history-actions {
  color: var(--accent);
}

.rag-history-open {
  position: relative;
  z-index: 2;
  flex: 1;
  min-width: 0;
  padding: 6px 7px;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.rag-history-open .history-question {
  font-size: 12px;
  line-height: 1.45;
  -webkit-line-clamp: 2;
}

.rag-history-open .history-meta {
  position: absolute;
  top: calc(100% + 2px);
  left: 7px;
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 230px;
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  color: var(--faint);
  font-size: 8.5px;
  line-height: 1.5;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-3px);
  pointer-events: none;
  transition:
    opacity 0.14s ease,
    transform 0.14s ease,
    visibility 0.14s ease;
}

.rag-history-open:hover .history-meta,
.rag-history-open:focus-visible .history-meta {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.rag-history-pin,
.rag-history-more {
  display: grid;
  place-items: center;
  flex: none;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: inherit;
  transition: color 0.15s ease, background 0.15s ease;
}

.rag-history-pin svg,
.rag-history-more svg {
  width: 14px;
  height: 14px;
}

.rag-history-pin {
  position: relative;
}

.rag-history-pin::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 8;
  padding: 3px 6px;
  border-radius: var(--radius-xs);
  background: var(--ink);
  color: var(--surface);
  font-size: 9px;
  line-height: 1.4;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-2px);
  pointer-events: none;
  transition:
    opacity 0.14s ease,
    transform 0.14s ease,
    visibility 0.14s ease;
}

.rag-history-pin:hover::after,
.rag-history-pin:focus-visible::after {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.rag-history-pin.is-pinned {
  color: var(--accent);
}

.rag-history-pin:hover,
.rag-history-more:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

@media (hover: none) {
  .rag-history-actions {
    opacity: 1;
    visibility: visible;
  }
}

.rag-history-menu {
  position: fixed;
  z-index: 140;
  min-width: 180px;
  max-width: min(260px, calc(100vw - 16px));
  max-height: min(70vh, 420px);
  padding: 4px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.rag-history-menu button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 9px;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--ink);
  font-size: 10.5px;
  text-align: left;
}

.rag-history-menu button:hover {
  background: var(--surface-2);
}

.rag-history-menu button svg {
  flex: none;
  color: var(--faint);
}

.rag-history-menu button.is-danger,
.rag-history-menu button.is-danger svg {
  color: var(--danger);
}

.rag-history-menu-divider {
  height: 1px;
  margin: 4px 2px;
  background: var(--line);
}

.rag-history-menu-head {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 9px;
  color: var(--faint);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.rag-history-menu-check {
  display: inline-flex;
  width: 14px;
  justify-content: center;
  color: var(--accent);
}

.rag-history-menu-note {
  padding: 6px 9px 8px;
  color: var(--faint);
  font-size: 9px;
  line-height: 1.5;
}

.rag-project {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 6px 7px;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  text-align: left;
}

.rag-project:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.rag-project.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.rag-project-name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.rag-project-name span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rag-project-count {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 8.5px;
}

.rag-project-add {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 6px 7px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--faint);
  font-size: 9.5px;
  text-align: left;
}

.rag-project-add:hover {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  color: var(--accent);
}

.rag-project-add-wrap {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 3px;
}

.rag-project-form {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 5px 1px 2px;
}

.rag-project-form .input {
  min-height: 30px;
  font-size: 10.5px;
}

.rag-project-form-actions {
  display: flex;
  gap: 4px;
}

.rag-project-form-actions .btn {
  flex: 1;
}

.rag-library-more {
  margin: 3px 0 1px;
  padding: 6px 7px;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--accent);
  font-size: 9.5px;
  text-align: left;
}

.rag-library-more:hover {
  background: var(--accent-soft);
}

.answer-card {
  min-height: 380px;
  overflow: hidden;
}

.rag-conversation {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.rag-turns {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

.rag-empty-answer {
  width: 100%;
}

.rag-turn {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  scroll-margin-top: calc(var(--header-height) + 18px);
}

.rag-user-bubble {
  align-self: flex-end;
  max-width: min(720px, 82%);
  padding: 10px 14px;
  border-radius: 16px 16px 4px 16px;
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-xs);
  font-size: 13px;
  line-height: 1.65;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.rag-assistant-turn {
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

.rag-followup {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: min(760px, 100%);
  margin: 2px 0 0 auto;
  padding: 10px 12px;
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-lg);
  background: var(--accent-soft);
  box-shadow: var(--shadow-xs);
}

.rag-followup:focus-within {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm), var(--focus);
}

.rag-followup-input {
  width: 100%;
  min-height: 42px;
  max-height: 160px;
  padding: 5px 4px 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.6;
  resize: none;
}

.rag-followup-input:focus {
  outline: none;
}

.rag-followup-input::placeholder {
  color: var(--faint);
}

.rag-followup-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.rag-followup-hint {
  color: var(--faint);
  font-size: 9px;
}

.rag-followup-hint kbd {
  padding: 1px 4px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: var(--radius-xs);
  background: var(--surface);
  color: var(--muted);
  font-size: 8px;
}

.rag-page.has-conversation .rag-hero {
  padding-top: 8px;
  padding-bottom: 18px;
}

.rag-page.has-conversation .rag-hero .rag-lead,
.rag-page.has-conversation .rag-hero .ask-card,
.rag-page.has-conversation .rag-hero .example-chips {
  display: none;
}

.rag-page.has-conversation .rag-title {
  font-size: clamp(1.7rem, 3.1vw, 2.5rem);
}

.answer-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
}

.answer-head-left {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.answer-head-left svg {
  width: 16px;
  height: 16px;
  color: var(--accent);
  flex: none;
}

.answer-head-title {
  font-size: clamp(14.5px, 1.5vw, 15.5px);
  font-weight: 700;
}

.answer-head-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 9.5px;
  flex: none;
}

.answer-model {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.5;
  white-space: nowrap;
}

.answer-model svg {
  width: 11px;
  height: 11px;
  color: var(--accent);
  flex: none;
}

.answer-body {
  padding: clamp(18px, 2.5vw, 26px);
}

.answer-block + .answer-block {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.answer-block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  color: var(--ink);
  font-size: clamp(14.5px, 1.5vw, 15.5px);
  font-weight: 700;
  letter-spacing: 0.01em;
}

.answer-block-head span + span {
  flex: none;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.law-answer-block {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.law-framework-table-wrap {
  max-height: none;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.law-framework-table {
  min-width: 520px;
}

.law-framework-table td:first-child {
  min-width: 150px;
  font-weight: 600;
  white-space: nowrap;
}

.law-framework-table td:nth-child(2) {
  min-width: 86px;
  white-space: nowrap;
}

.law-framework-sources {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 7px;
  margin-top: 10px;
  color: var(--faint);
  font-size: 9.5px;
}

.law-framework-sources > span:first-child {
  margin-right: 2px;
  font-weight: 600;
}

.law-answer-block .answer-text {
  font-size: 13px;
  line-height: 1.75;
}

.law-answer-content {
  margin-top: 7px;
}

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

.law-answer-source {
  min-width: 0;
}

.law-answer-source-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 3px 7px;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.6;
}

.law-answer-law {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-weight: 650;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.law-answer-law:hover {
  color: var(--ink);
}

.law-answer-source-meta {
  color: var(--muted);
  font-size: 11.5px;
}

.law-answer-index {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 10px;
}

.law-answer-articles-label {
  margin-top: 7px;
  color: var(--faint);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.law-answer-articles {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 4px;
}

.law-answer-article {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 9px;
  width: 100%;
  min-width: 0;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.law-answer-article:hover {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.law-answer-article.is-static {
  cursor: default;
}

.law-answer-article-no {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 10.5px;
  white-space: nowrap;
}

.law-answer-article-text {
  display: -webkit-box;
  min-width: 0;
  overflow: hidden;
  font-size: 11px;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.chip-action {
  cursor: pointer;
}

@media (max-width: 560px) {
  .law-answer-article {
    grid-template-columns: 1fr;
    gap: 3px;
  }
}

.answer-text {
  color: var(--ink);
  font-size: clamp(14px, 1.4vw, 15.5px);
  line-height: 1.9;
  white-space: pre-wrap;
}

/* RAG question input and answer body share the same 14px reading size. */
.rag-page .ask-input,
.rag-page .rag-followup-input,
.rag-page .answer-text,
.rag-page .law-answer-block .answer-text {
  font-size: 14px;
}

.answer-text.is-streaming::after {
  content: "▍";
  margin-left: 1px;
  color: var(--accent);
  animation: answer-stream-cursor 900ms steps(2, start) infinite;
}

@keyframes answer-stream-cursor {
  50% {
    opacity: 0;
  }
}

.answer-head-left {
  order: 1;
}

.answer-head-meta {
  order: 3;
}

.answer-head > .rag-process {
  display: contents;
}

.rag-process-control {
  order: 2;
  display: inline-flex;
  align-items: stretch;
  min-width: 0;
  max-width: 100%;
  margin-right: auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
}

.rag-process-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  padding: 4px 9px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 650;
  line-height: 1.4;
  white-space: nowrap;
  cursor: pointer;
}

.rag-process-toggle:hover,
.rag-process-toggle:focus-visible {
  background: var(--accent-soft);
  color: var(--accent);
  outline: none;
}

.rag-process-toggle svg {
  width: 11px;
  height: 11px;
  flex: none;
  transition: transform 0.16s ease;
}

.rag-process.is-open .rag-process-toggle svg {
  transform: rotate(180deg);
}

.rag-process-toggle-label-expanded {
  display: none;
}

.rag-process.is-open .rag-process-toggle-label-collapsed {
  display: none;
}

.rag-process.is-open .rag-process-toggle-label-expanded {
  display: inline;
}

.rag-process-summary {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 8.5px;
  white-space: nowrap;
}

.rag-process-body {
  order: 4;
  flex: 1 0 100%;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.rag-process-body[hidden] {
  display: none;
}

.rag-process-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 6px 12px 9px;
}

.rag-process-list.is-waterfall {
  display: block;
  padding: 0 12px;
}

.rag-process-list.is-waterfall .rag-wf-axis {
  padding: 10px 0 2px;
}

.rag-process-list.is-waterfall .rag-wf-stages {
  padding: 0 0 8px;
}

.rag-process-list.is-waterfall .rag-wf-hint {
  padding: 0 0 10px;
}

.rag-process-item {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  min-width: 0;
  padding: 4px 0 4px calc(var(--depth, 0) * 12px);
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.rag-process-dot {
  width: 6px;
  height: 6px;
  margin-top: 4px;
  flex: none;
  border-radius: 50%;
  background: var(--success);
}

.rag-process-item.is-running .rag-process-dot {
  background: var(--accent);
  animation: rag-process-pulse 1.1s ease-in-out infinite;
}

.rag-process-item.is-error .rag-process-dot {
  background: var(--danger);
}

.rag-process-label {
  min-width: 0;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rag-process-meta {
  margin-left: auto;
  flex: none;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 8.5px;
}

.rag-process-hint {
  padding: 0 12px 9px;
  color: var(--faint);
  font-size: 9px;
}

@keyframes rag-process-pulse {
  0%, 100% { opacity: 0.35; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1); }
}

.answer-notice {
  margin-top: 16px;
  padding: 11px 13px;
  border-left: 2px solid var(--accent);
  background: var(--accent-soft);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.65;
}

.answer-divider {
  height: 1px;
  margin: 22px 0 18px;
  background: var(--line);
}

.answer-section-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.06em;
}

.answer-section-label span + span {
  flex: none;
  color: var(--faint);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.citation-list {
  display: grid;
  gap: 9px;
}

.citation {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: start;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-soft);
  transition: border-color 0.16s ease, transform 0.16s ease;
}

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

.citation-index {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-xs);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 10px;
}

.citation-body {
  min-width: 0;
}

.citation-name {
  font-size: 12.5px;
  font-weight: 650;
  line-height: 1.4;
}

.citation-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin-top: 4px;
  color: var(--faint);
  font-size: 10px;
}

.citation-snippet {
  display: -webkit-box;
  overflow: hidden;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* Citation card snippets use the same 14px reading size as the answer. */
.rag-page .citation-snippet,
.rag-page .law-source-article-text,
.rag-page .law-answer-article-text {
  font-size: 14px;
}

.citation-link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 6px;
  border-radius: var(--radius-xs);
  color: var(--accent);
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.citation-link:hover {
  background: var(--accent-soft);
}

.law-source {
  align-items: start;
}

.law-source-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 10px;
  margin-top: 7px;
  padding: 6px 8px;
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 10px;
}

.law-source-article {
  margin-top: 7px;
  padding: 7px 9px;
  border-left: 2px solid var(--accent-border);
  background: var(--surface-2);
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
}

.law-source-article[data-action] {
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
}

.law-source-article[data-action]:hover,
.law-source-article[data-action]:focus-visible {
  border-left-color: var(--accent);
  background: var(--accent-soft);
  outline: none;
}

.law-source-article[data-action]:focus-visible {
  box-shadow: 0 0 0 2px var(--accent-border);
}

.law-source-article-no {
  display: block;
  margin-bottom: 3px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
}

.law-source-article-text {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.65;
  white-space: pre-wrap;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

.citation-link svg {
  width: 11px;
  height: 11px;
}

.answer-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 340px;
  padding: 32px 24px;
  text-align: center;
}

.answer-placeholder .empty-icon {
  width: 62px;
  height: 62px;
  border-radius: var(--radius-lg);
}

.answer-placeholder .empty-title {
  font-size: 17px;
}

.side-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.side-card-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 650;
}

.side-card-title svg {
  width: 14px;
  height: 14px;
  color: var(--faint);
}

.side-card-body {
  padding: 14px 16px;
}

.mini-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--line);
}

.mini-stat {
  padding: 11px 8px;
  background: var(--surface);
  text-align: center;
}

.mini-stat-value {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.mini-stat-label {
  margin-top: 3px;
  color: var(--faint);
  font-size: 9px;
  letter-spacing: 0.04em;
}

.side-status-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 13px;
}

.side-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 11px;
}

.side-status-row span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
}

.side-card-foot {
  padding: 11px 16px;
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--faint);
  font-size: 10px;
  line-height: 1.6;
}

.history-question {
  display: -webkit-box;
  overflow: hidden;
  font-size: 11.5px;
  font-weight: 550;
  line-height: 1.5;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.history-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 9px;
}

/* ------------------------------------------------------------------ data */
.data-page .page-header {
  align-items: center;
  margin-bottom: 14px;
}

.data-page-heading {
  min-width: 0;
}

.data-page-heading > .eyebrow {
  margin-bottom: 2px;
}

.data-title-line {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
}

.data-title-line .page-title {
  flex: none;
  font-size: clamp(1.35rem, 2vw, 1.7rem);
  line-height: 1.1;
}

.data-page-subtitle {
  max-width: none;
  margin-top: 0;
  font-size: 12.5px;
  line-height: 1.5;
}

.data-layout {
  display: grid;
  grid-template-columns: 342px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.query-sidebar {
  position: sticky;
  top: calc(var(--header-height) + 18px);
  display: flex;
  flex-direction: column;
  overflow: visible;
  border-radius: var(--radius-lg);
}

.data-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.data-nav-item {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.data-nav-item:hover {
  background: var(--surface-2);
}

.data-nav-item.is-active {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  color: var(--accent);
}

.data-nav-icon {
  display: inline-flex;
  flex: none;
  color: var(--faint);
}

.data-nav-item.is-active .data-nav-icon {
  color: var(--accent);
}

.data-nav-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.data-nav-copy strong {
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 650;
}

.data-nav-item.is-active .data-nav-copy strong {
  color: var(--accent);
}

.data-nav-copy small {
  overflow: hidden;
  color: var(--faint);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-source-field {
  margin: 0;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
}

.data-advanced {
  padding: 8px 10px;
  border-top: 1px solid var(--line);
}

.data-advanced > summary {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.data-advanced > summary::-webkit-details-marker {
  display: none;
}

.data-advanced > summary::before {
  content: "▸";
  margin-right: 4px;
  color: var(--faint);
  font-size: 9px;
}

.data-advanced[open] > summary::before {
  content: "▾";
}

.data-fuzzy {
  position: relative;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.data-fuzzy-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 6px;
}

.data-fuzzy-row {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.data-fuzzy-values {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  flex-wrap: wrap;
  gap: 4px;
}

.data-fuzzy-placeholder {
  color: var(--faint);
  font-size: 9.5px;
  line-height: 1.5;
}

.data-fuzzy-chip {
  gap: 3px;
  padding: 2px 3px 2px 7px;
  font-size: 9.5px;
}

.data-fuzzy-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 2px;
  border: 0;
  background: transparent;
  color: var(--faint);
  cursor: pointer;
}

.data-fuzzy-remove:hover {
  color: var(--danger);
}

.data-fuzzy-add {
  display: inline-flex;
  width: 22px;
  height: 22px;
  flex: none;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.data-fuzzy-add:hover,
.data-fuzzy-add:focus-visible {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  color: var(--accent);
  outline: none;
}

.data-fuzzy-popover {
  position: absolute;
  top: calc(100% + 4px);
  right: 10px;
  left: 10px;
  z-index: 30;
  padding: 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.data-fuzzy-popover[hidden] {
  display: none;
}

.data-fuzzy-popover .input {
  width: 100%;
}

.data-fuzzy-results {
  display: flex;
  max-height: 260px;
  flex-direction: column;
  gap: 2px;
  margin-top: 6px;
  overflow: auto;
}

.data-fuzzy-option {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 8px;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 10.5px;
  text-align: left;
  cursor: pointer;
}

.data-fuzzy-option:hover,
.data-fuzzy-option:focus {
  background: var(--accent-soft);
  color: var(--accent);
  outline: none;
}

.data-fuzzy-option small {
  flex: none;
  color: var(--faint);
  font-size: 9px;
}

.data-fuzzy-loading {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 4px;
  color: var(--faint);
  font-size: 10px;
}

.data-fuzzy-empty {
  padding: 8px 4px;
  color: var(--faint);
  font-size: 10px;
  line-height: 1.5;
}

.schema-category-switch {
  display: flex;
  gap: 6px;
  padding: 8px;
  border-bottom: 1px solid var(--line);
}

.schema-category-switch .chip.is-active {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  color: var(--accent);
}

.sidebar-head {
  padding: 15px 16px 12px;
  border-bottom: 1px solid var(--line);
}

.sidebar-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 650;
}

.sidebar-title svg {
  width: 15px;
  height: 15px;
  color: var(--accent);
}

.sidebar-sub {
  margin-top: 3px;
  color: var(--faint);
  font-size: 10.5px;
}

.category-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 8px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.category-option {
  position: relative;
  display: flex;
  min-width: 0;
}

.category-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.category-option-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    background 0.16s ease;
}

.category-option-body:hover {
  border-color: var(--line-strong);
}

.category-option input:checked + .category-option-body {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent-border);
}

.category-option input:focus-visible + .category-option-body {
  box-shadow: var(--focus);
}

.category-option-label {
  font-size: 11.5px;
  font-weight: 700;
}

.category-option-desc {
  overflow: hidden;
  color: var(--faint);
  font-size: 8.5px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.db-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 8px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
}

.db-option {
  position: relative;
  display: flex;
  min-width: 0;
}

.db-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.db-option-body {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.db-option-body:hover {
  border-color: var(--line-strong);
}

.db-option input:checked + .db-option-body {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent-border);
}

.db-option input:focus-visible + .db-option-body {
  box-shadow: var(--focus);
}

.db-option-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
}

.db-option-name {
  font-size: 11.5px;
  font-weight: 650;
}

.db-option-radio {
  width: 11px;
  height: 11px;
  border: 1.5px solid var(--line-strong);
  border-radius: 50%;
  flex: none;
}

.db-option input:checked + .db-option-body .db-option-radio {
  border: 3px solid var(--accent);
  background: var(--surface);
}

.db-option-desc {
  display: -webkit-box;
  overflow: hidden;
  color: var(--faint);
  font-size: 9px;
  line-height: 1.4;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.db-option-state {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--faint);
  font-size: 8.5px;
  font-weight: 500;
}

.db-option-state .status-dot {
  width: 5px;
  height: 5px;
  box-shadow: none;
}

.filter-block {
  padding: 9px 9px 3px;
}

.filter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.filter-title {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.filter-reset {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 4px;
  border-radius: var(--radius-xs);
}

.filter-reset:hover {
  background: var(--accent-soft);
}

.filter-fields {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.filter-fields .field-row {
  gap: 8px;
}

.sidebar-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 9px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.sidebar-actions .btn {
  width: 100%;
}

.sidebar-view-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 8px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
}

.sidebar-view-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-size: 11.5px;
  font-weight: 650;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    background 0.16s ease,
    color 0.16s ease;
}

.sidebar-view-button:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.sidebar-view-button.is-active {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent-border);
}

.sidebar-view-button:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.schema-panel {
  padding: 0 16px 16px;
}

.schema-list {
  display: grid;
  gap: 7px;
  margin-top: 10px;
}

.schema-item {
  display: block;
  width: 100%;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.schema-item:hover:not(:disabled) {
  border-color: var(--accent-border);
  background: var(--surface);
}

.schema-item.is-selected {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent-border);
}

.schema-item:disabled {
  cursor: default;
  opacity: 0.72;
}

.schema-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.schema-item-name {
  font-size: 11.5px;
  font-weight: 650;
}

.schema-item-action {
  flex: none;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 9px;
}

.schema-item-id {
  display: block;
  margin-top: 2px;
  color: var(--faint);
  font-size: 9px;
}

.schema-item-desc {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.schema-preview-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
}

.schema-preview-footer strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
}

.schema-preview .table-wrap {
  max-height: 520px;
}

.schema-preview .data-table {
  min-width: 1100px;
}

.schema-preview .data-table td {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-table.is-compact {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
}

.data-table.is-compact td {
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow-wrap: normal;
}

.data-table.is-compact .law-link,
.data-table.is-compact .judgment-link {
  white-space: nowrap;
}

.schema-preview .data-table th,
.schema-preview .data-table .table-sort {
  text-transform: none;
}

.schema-search-row th {
  position: static;
  padding: 4px 6px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.schema-search-wrap {
  display: block;
}

.schema-search-input {
  width: 100%;
  min-width: 80px;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 9.5px;
}

.schema-search-input::placeholder {
  color: var(--faint);
}

.schema-search-input:focus {
  outline: none;
  border-color: var(--accent-border);
  box-shadow: var(--focus);
}

.schema-suggest-popover {
  position: fixed;
  z-index: 200;
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
}

.schema-suggest-head {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 7px 9px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 9px;
}

.schema-suggest-item {
  display: block;
  width: 100%;
  padding: 7px 9px;
  overflow: hidden;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-size: 10.5px;
  line-height: 1.4;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schema-suggest-item:last-child {
  border-bottom: 0;
}

.schema-suggest-item:hover,
.schema-suggest-item.is-active {
  background: var(--accent-soft);
  color: var(--accent);
}

.schema-suggest-item mark {
  padding: 0 1px;
  border-radius: 2px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 750;
}

.sidebar-note {
  padding: 0 9px 9px;
  color: var(--faint);
  font-size: 9.5px;
  line-height: 1.55;
}

.query-main {
  min-width: 0;
}

.report-empty {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.report-empty .empty-icon {
  border-style: dashed;
}

.report-empty .query-hint-grid {
  padding: 0 22px 26px;
  margin-inline: auto;
}

.report-table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 18px 10px;
}

.sidebar-notice {
  padding: 8px 9px 0;
}

.detail-list {
  display: flex;
  flex-direction: column;
  padding: 4px 16px 8px;
}

.detail-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 10.5px;
}

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

.detail-label {
  color: var(--faint);
  flex: none;
}

.detail-value {
  min-width: 0;
  color: var(--ink);
  text-align: right;
  overflow-wrap: anywhere;
}

.detail-value code {
  display: inline-block;
  max-width: 230px;
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  white-space: nowrap;
  text-overflow: ellipsis;
  vertical-align: bottom;
}

.side-card-foot code,
.status-footnote code {
  padding: 1px 4px;
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 9px;
}

.notice-icon svg {
  width: 11px;
  height: 11px;
}

@media (hover: none) {
  .query-box .btn-copy {
    opacity: 1;
  }
}

.query-hint-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
  max-width: 720px;
  margin-top: 26px;
  text-align: left;
}

.query-hint {
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.query-hint strong {
  display: block;
  font-size: 11px;
  font-weight: 650;
}

.query-hint span {
  display: block;
  margin-top: 3px;
  color: var(--faint);
  font-size: 9.5px;
  line-height: 1.5;
}

/* Report surfaces are re-rendered for paging/sorting/page-size changes.
   Never add entry animations or opacity transitions here (see FR-111). */
.report-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.report-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
}

.report-title-group {
  min-width: 0;
}

.report-kicker {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 4px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.report-title {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.report-sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10.5px;
}

.law-link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  max-width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-weight: 600;
  text-align: left;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

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

.law-link-icon {
  flex: none;
  opacity: 0.65;
}

.data-table td.cell-jid {
  width: 1%;
  max-width: none;
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
}

.cell-jid .judgment-link {
  max-width: none;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 10.5px;
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
}

.data-table td.cell-date,
.data-table td.cell-datetime,
.data-table td.cell-duration,
.data-table td.cell-number {
  width: 1%;
  max-width: none;
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
}

.data-table td.cell-date {
  min-width: 90px;
}

.data-table td.cell-datetime {
  min-width: 132px;
}

.data-table td.cell-duration {
  min-width: 70px;
}

.data-table td.cell-number {
  min-width: 52px;
}

.cell-date .mono,
.cell-datetime .mono,
.cell-duration .mono,
.cell-number .mono {
  white-space: nowrap;
}

.law-report-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.law-report-origin {
  flex: 1 1 220px;
  min-width: 0;
  overflow: hidden;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 9px;
  line-height: 1.5;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.law-version-select {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--faint);
  font-size: 9.5px;
  white-space: nowrap;
}

.law-version-select .select {
  max-width: 260px;
  padding: 5px 8px;
  font-size: 10px;
}

.law-version-changes > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  list-style: none;
}

.law-version-changes > summary::-webkit-details-marker {
  display: none;
}

.law-version-change-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.law-version-change {
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.law-version-change-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
  font-size: 10.5px;
}

.law-version-change details {
  margin-top: 5px;
  color: var(--muted);
  font-size: 9.5px;
}

.law-version-change pre {
  max-height: 220px;
  margin: 5px 0 0;
  overflow: auto;
  padding: 8px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 9px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.law-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--line);
}

.law-meta-item {
  min-width: 0;
  padding: 10px 12px;
  background: var(--surface);
}

.law-meta-label {
  color: var(--faint);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.law-meta-value {
  margin-top: 3px;
  font-size: 11px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.law-text-block {
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.75;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.law-disclosure {
  padding: 16px 18px;
}

.law-disclosure-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  list-style: none;
  cursor: pointer;
  user-select: none;
}

.law-disclosure-summary::-webkit-details-marker {
  display: none;
}

.law-disclosure-summary:focus-visible {
  border-radius: var(--radius-xs);
  outline: none;
  box-shadow: var(--focus);
}

.law-disclosure-summary:hover .report-section-title {
  color: var(--ink);
}

.law-disclosure-hint {
  margin-left: auto;
  color: var(--faint);
  font-size: 9.5px;
}

.law-disclosure-chevron {
  flex: none;
  color: var(--faint);
  transition: transform 0.18s ease;
}

.law-disclosure[open] .law-disclosure-hint {
  display: none;
}

.law-disclosure[open] .law-disclosure-chevron {
  transform: rotate(180deg);
}

.law-disclosure .law-text-block {
  margin-top: 12px;
}

.law-attachment-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.law-attachment {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  max-width: 100%;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--accent);
  font-size: 10.5px;
  overflow-wrap: anywhere;
}

.law-articles-section {
  padding: 0;
}

.law-articles-section > .report-section-head {
  padding: 16px 18px 0;
}

.law-article-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.law-article-jump {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.law-dialog-jump {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.law-article-jump-input {
  width: 118px;
  height: 30px;
  padding: 4px 8px;
  font-family: var(--font-mono);
  font-size: 10.5px;
}

.law-jump-float {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 55;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.16);
}

.law-page-label {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 9.5px;
}

.law-article-list {
  border-top: 1px solid var(--line);
}

.law-article {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.law-article.is-jump-target {
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.law-article:last-child {
  border-bottom: 0;
}

.law-article-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}

.law-article-no {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.law-article-text {
  color: var(--ink);
  font-size: 12px;
  line-height: 1.9;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.law-chapter {
  padding: 14px 18px 10px;
  border-bottom: 1px dashed var(--line);
  background: var(--bg-soft);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.law-article-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 18px;
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
}

.summary-value-text {
  font-size: clamp(0.8rem, 1.1vw, 1rem);
  line-height: 1.4;
}

.judgment-citation-groups {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.judgment-citation-group {
  display: grid;
  grid-template-columns: minmax(100px, 160px) minmax(0, 1fr);
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.judgment-citation-law {
  color: var(--accent);
  font-size: 11px;
  font-weight: 650;
}

.judgment-citation-articles {
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.judgment-text-section {
  padding: 0;
}

.judgment-text-section > .report-section-head {
  padding: 16px 18px 0;
}

.judgment-fulltext {
  margin-top: 12px;
  padding: 16px 18px;
  border-top: 1px solid var(--line);
  color: var(--ink);
  font-size: 12.5px;
  line-height: 1.95;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (max-width: 760px) {
  .law-report-origin {
    flex-basis: 100%;
    text-align: left;
    white-space: normal;
  }

  .law-article-controls {
    justify-content: flex-start;
  }

  .law-dialog-jump {
    justify-content: flex-start;
  }

  .law-jump-float {
    right: 12px;
    bottom: 12px;
  }

  .judgment-citation-group {
    grid-template-columns: 1fr;
    gap: 3px;
  }
}

.report-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.summary-item {
  padding: 14px 18px;
  border-right: 1px solid var(--line);
}

.summary-item:last-child {
  border-right: 0;
}

.summary-label {
  color: var(--faint);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.summary-value {
  margin-top: 4px;
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 1.7vw, 1.5rem);
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.report-alert {
  margin: 14px 18px 0;
}

.report-section {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.report-section:last-child {
  border-bottom: 0;
}

.report-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.report-section-title {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.report-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  border-bottom: 1px solid var(--line);
}

.report-grid .report-section {
  border-bottom: 0;
}

.report-grid .report-section + .report-section {
  border-left: 1px solid var(--line);
}

.distribution {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.dist-row {
  display: grid;
  grid-template-columns: minmax(80px, 150px) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.dist-label {
  overflow: hidden;
  color: var(--muted);
  font-size: 10.5px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.dist-track {
  height: 6px;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
}

.dist-bar {
  height: 100%;
  min-width: 2px;
  border-radius: inherit;
  background: var(--accent);
}

.dist-value {
  min-width: 42px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 9.5px;
  text-align: right;
}

.report-empty-inline {
  padding: 18px;
  color: var(--faint);
  font-size: 11px;
  text-align: center;
}

.query-box {
  position: relative;
}

.query-code {
  max-height: 168px;
  overflow: auto;
  margin: 0;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--code-bg);
  color: var(--code-ink);
  font-size: 10.5px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.query-box .btn-copy {
  position: absolute;
  top: 7px;
  right: 7px;
  opacity: 0;
  transition: opacity 0.16s ease;
}

.query-box:hover .btn-copy,
.query-box:focus-within .btn-copy {
  opacity: 1;
}

.warnings {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.warning-line {
  display: flex;
  gap: 7px;
  color: var(--warning);
  font-size: 10.5px;
  line-height: 1.5;
}

.warning-line::before {
  content: "!";
  display: grid;
  place-items: center;
  width: 14px;
  height: 14px;
  margin-top: 1px;
  border-radius: 50%;
  background: var(--warning-soft);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  flex: none;
}

.table-wrap {
  overflow: auto;
  max-height: 560px;
  border-top: 1px solid var(--line);
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 11px;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line-strong);
  background: var(--bg-soft);
  color: var(--faint);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-align: left;
  text-transform: uppercase;
  vertical-align: middle;
  white-space: nowrap;
}

.table-sort {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  white-space: nowrap;
  cursor: pointer;
}

.table-sort:hover,
.table-sort.is-active {
  color: var(--accent);
}

.table-sort:focus-visible {
  border-radius: var(--radius-xs);
  outline: none;
  box-shadow: var(--focus);
}

.table-sort-icon {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1;
}

.table-sort.is-active .table-sort-icon {
  color: var(--accent);
}

.data-table td {
  max-width: 320px;
  padding: 3px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  vertical-align: middle;
  overflow-wrap: anywhere;
}

.data-table .badge {
  padding: 1px 6px;
  font-size: 9px;
  line-height: 1.25;
}

.data-table tbody tr:nth-child(even) td {
  background: var(--table-stripe);
}

.data-table tbody tr:hover td {
  background: var(--accent-soft);
}

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

.cell-mono {
  font-family: var(--font-mono);
  font-size: 9.5px;
  line-height: 1.5;
}

.data-table th.cell-index-head,
.data-table td.cell-index {
  width: 52px;
  min-width: 52px;
  max-width: none;
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
}

.data-table td.cell-index,
.data-table td.cell-number {
  font-size: 10px;
}

.cell-truncate {
  display: inline-block;
  max-width: 280px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  vertical-align: bottom;
}

.cell-url a {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  max-width: 240px;
  overflow: hidden;
  font-size: 10px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.cell-url svg {
  width: 10px;
  height: 10px;
  flex: none;
}

.cell-empty {
  color: var(--faint);
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 16px;
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
  flex-wrap: wrap;
}

.pagination-info {
  color: var(--faint);
  font-size: 10.5px;
}

.pagination-info strong {
  color: var(--ink);
  font-weight: 600;
}

.pagination-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}

.page-size {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-right: 7px;
  color: var(--faint);
  font-size: 10px;
}

.page-size .select {
  min-height: 28px;
  width: auto;
  padding: 4px 26px 4px 8px;
  font-size: 10px;
  background-position: calc(100% - 13px) 12px, calc(100% - 9px) 12px;
}

.page-btn {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: var(--surface);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
}

.page-btn:hover:not(:disabled) {
  border-color: var(--accent-border);
  color: var(--accent);
}

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

.page-btn svg {
  width: 13px;
  height: 13px;
}

.report-loading {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

/* ---------------------------------------------------------------- status */
.status-page .page-header {
  margin-bottom: 18px;
}

.status-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: clamp(18px, 2.5vw, 26px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--hero-bg);
  box-shadow: var(--shadow-xs);
}

.status-hero-main {
  min-width: 0;
}

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

.overall-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 13px 7px 10px;
  border-radius: var(--radius-pill);
  background: var(--success-soft);
  color: var(--success);
  font-size: 12px;
  font-weight: 650;
}

.overall-badge.is-warn {
  background: var(--warning-soft);
  color: var(--warning);
}

.overall-badge.is-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.overall-badge .status-dot {
  width: 7px;
  height: 7px;
  box-shadow: none;
}

.status-headline {
  margin-top: 12px;
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 2.4vw, 2rem);
  font-weight: var(--display-weight);
  letter-spacing: var(--display-tracking);
  line-height: 1.2;
}

.status-copy {
  max-width: 680px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.7;
}

.status-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-top: 16px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 9.5px;
}

.status-meta span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.status-meta svg {
  width: 11px;
  height: 11px;
}

.status-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}

.auto-refresh {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 10.5px;
  cursor: pointer;
  user-select: none;
}

.auto-refresh input {
  width: 13px;
  height: 13px;
  accent-color: var(--accent);
}

/* Service overview page-load pipeline.  Uses the canonical RAG waterfall
   structure so phase timing, axis, bars and details stay consistent. */
.status-wf-card {
  margin-top: 16px;
  overflow: visible;
}

.status-wf-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 14px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 9.5px;
}

.status-wf-summary strong {
  color: var(--ink);
  font-weight: 600;
}

.status-wf-chart .rag-wf-axis {
  padding: 12px 16px 2px;
}

.status-wf-chart .rag-wf-legend {
  padding: 4px 16px 7px;
}

.status-wf-chart .rag-wf-stages {
  padding: 0 16px 12px;
}

.status-wf-chart .rag-wf-hint {
  padding: 0 16px 14px;
}

.status-wf-step {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 8.5px;
}

.status-wf-stage .status-wf-step {
  margin-right: 4px;
}

.status-wf-stage.is-error .rag-wf-stage-meta {
  color: var(--danger);
}

.status-wf-stage.is-skipped .rag-wf-track {
  opacity: 0.55;
}

.workflow-wf-legend i.is-failed-state {
  background: var(--danger);
}

@media (max-width: 640px) {
  .status-wf-summary {
    padding: 10px 12px;
  }

  .status-wf-chart .rag-wf-axis,
  .status-wf-chart .rag-wf-legend,
  .status-wf-chart .rag-wf-stages,
  .status-wf-chart .rag-wf-hint {
    padding-left: 12px;
    padding-right: 12px;
  }

  .status-wf-card .rag-wf-stage-head {
    flex-wrap: wrap;
  }

  .status-wf-card .rag-wf-stage-meta {
    justify-content: flex-start;
    white-space: normal;
  }
}

.service-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.service-card {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  transition: border-color 0.16s ease, transform 0.16s ease;
}

.service-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.service-top {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.service-icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  color: var(--muted);
  flex: none;
}

.service-icon svg {
  width: 14px;
  height: 14px;
}

.service-name {
  min-width: 0;
  overflow: hidden;
  font-size: 11.5px;
  font-weight: 650;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.service-kind {
  margin-left: auto;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  flex: none;
}

.service-status {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 10.5px;
  font-weight: 550;
}

.service-detail {
  display: -webkit-box;
  overflow: hidden;
  color: var(--faint);
  font-size: 9.5px;
  line-height: 1.5;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.service-latency {
  margin-left: auto;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 8.5px;
}

.data-section {
  margin-top: 20px;
}

.architecture-card {
  padding: 18px;
}

.arch-flow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px minmax(0, 1fr) 28px minmax(0, 1fr) 28px minmax(0, 1fr);
  align-items: stretch;
  gap: 0;
}

.arch-layer {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-soft);
}

.arch-layer-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.arch-layer-label::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.arch-nodes {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.arch-node {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: var(--surface);
  color: var(--ink);
  font-size: 10px;
  font-weight: 550;
  line-height: 1.4;
}

.arch-node strong {
  font-weight: 650;
}

.arch-node-detail {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 450;
  line-height: 1.45;
}

.arch-node.is-muted {
  color: var(--faint);
  border-style: dashed;
}

.arch-node.is-muted .arch-node-detail {
  color: var(--faint);
}

.arch-arrow {
  display: grid;
  place-items: center;
  color: var(--line-strong);
}

.arch-arrow svg {
  width: 15px;
  height: 15px;
}

.arch-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 14px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 9.5px;
}

.arch-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.arch-diagram {
  margin: 18px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.arch-diagram-head {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 10px;
}

.arch-diagram-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg-soft);
  scrollbar-width: thin;
}

.arch-diagram-svg {
  display: block;
  width: 100%;
  min-width: 860px;
  height: auto;
  color: var(--muted);
}

.arch-diagram-lane {
  fill: var(--surface-2);
  stroke: var(--line);
  stroke-width: 1;
}

.arch-diagram-lane-label {
  fill: var(--faint);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.13em;
}

.arch-diagram-node {
  fill: var(--surface);
  stroke: var(--line-strong);
  stroke-width: 1;
}

.arch-diagram-node-title {
  fill: var(--ink);
  font-size: 11px;
  font-weight: 650;
}

.arch-diagram-node-sub {
  fill: var(--muted);
  font-size: 8.8px;
}

.arch-diagram-flow {
  fill: none;
  stroke: var(--faint);
  stroke-width: 1.5;
  marker-end: url(#arch-arrow);
}

.arch-diagram-flow-accent {
  stroke: var(--accent);
  marker-end: url(#arch-arrow-accent);
}

.arch-diagram-flow-both {
  marker-start: url(#arch-arrow);
  marker-end: url(#arch-arrow);
}

.arch-diagram-flow-label {
  fill: var(--faint);
  font-family: var(--font-mono);
  font-size: 8.5px;
}

.arch-diagram-flow-badge circle {
  fill: var(--accent-soft);
  stroke: var(--accent);
  stroke-width: 1;
}

.arch-diagram-flow-badge text {
  fill: var(--accent);
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 700;
  text-anchor: middle;
}

.arch-diagram-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-top: 9px;
  color: var(--faint);
  font-size: 9px;
  line-height: 1.5;
}

.arch-diagram-legend b {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 9px;
}

.legend-key {
  width: 9px;
  height: 9px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: var(--surface);
}

.legend-key.is-live {
  border-color: var(--success);
  background: var(--success-soft);
}

.legend-key.is-off {
  border-style: dashed;
  border-color: var(--faint);
  background: transparent;
}

.status-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 16px;
  margin-top: 16px;
  align-items: start;
}

.endpoint-list {
  display: flex;
  flex-direction: column;
}

.endpoint-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 10.5px;
}

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

.endpoint-method {
  display: inline-grid;
  place-items: center;
  padding: 2px 5px;
  border-radius: var(--radius-xs);
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 700;
}

.endpoint-path {
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 10px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.endpoint-label {
  color: var(--faint);
  font-size: 9.5px;
  white-space: nowrap;
}

.runs-table td {
  font-size: 10px;
}

.status-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.status-footnote {
  margin-top: 16px;
  color: var(--faint);
  font-size: 9.5px;
  line-height: 1.6;
}

/* --------------------------------------------------- status sidebar/resources */
.status-layout {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.status-sidebar {
  position: sticky;
  top: 86px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.status-sidebar-head {
  padding: 6px 8px 10px;
}

.status-sidebar-head .eyebrow {
  margin-bottom: 4px;
}

.status-sidebar-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.015em;
}

.status-tab-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.status-tab-divider {
  flex: none;
  height: 1px;
  margin: 6px 4px;
  background: var(--line);
}

.status-tab {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  width: 100%;
  min-width: 0;
  padding: 9px 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.status-tab:hover {
  border-color: var(--line);
  background: var(--surface-2);
  color: var(--ink);
}

.status-tab.is-active {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  color: var(--ink);
}

.status-tab-icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  color: var(--faint);
}

.status-tab.is-active .status-tab-icon {
  background: var(--surface);
  color: var(--accent);
}

.status-tab-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.status-tab-copy strong {
  min-width: 0;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.35;
}

.status-tab-copy small {
  display: block;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  color: var(--faint);
  font-size: 9px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-tab .badge {
  margin-left: auto;
  flex: none;
  padding: 2px 6px;
  font-size: 8px;
}

.status-sidebar-foot {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 10px;
  padding: 10px 8px 4px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 9px;
}

.status-panel {
  min-width: 0;
}

.ollama-host-form {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(220px, 1.6fr) 110px auto;
  gap: 8px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.ollama-host-form .field {
  min-width: 0;
}

.ollama-host-form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.ollama-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 22px 10px;
  color: var(--faint);
  font-size: 10.5px;
}

.ollama-host-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.ollama-host-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.ollama-host-card.is-active {
  border-color: var(--accent-border);
  box-shadow: inset 2px 0 0 var(--accent);
}

.ollama-host-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.ollama-host-title {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.ollama-host-name {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.ollama-host-name strong {
  color: var(--ink);
  font-size: 11.5px;
}

.ollama-host-url {
  color: var(--muted);
  font-size: 10px;
  overflow-wrap: anywhere;
}

.ollama-host-detail {
  color: var(--faint);
  font-size: 9.5px;
}

.ollama-model-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.ollama-model-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: var(--radius-xs);
}

.ollama-model-row:hover {
  background: var(--surface-2);
}

.ollama-model-main {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 1px;
}

.ollama-model-main strong {
  color: var(--ink);
  font-size: 10.5px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.ollama-model-meta {
  color: var(--faint);
  font-size: 9px;
}

.ollama-model-capabilities {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}

.ollama-model-capabilities .badge {
  padding: 1px 5px;
  font-size: 8px;
  line-height: 1.5;
}

.ollama-model-roles {
  display: flex;
  flex: none;
  gap: 4px;
}

.ollama-model-actions {
  display: flex;
  flex: none;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.ollama-model-row:hover .ollama-model-actions,
.ollama-model-row:focus-within .ollama-model-actions {
  opacity: 1;
}

.ollama-empty {
  padding: 10px 8px;
  color: var(--faint);
  font-size: 10px;
}

@media (hover: none) {
  .ollama-model-actions {
    opacity: 1;
  }
}

@media (max-width: 1020px) {
  .ollama-host-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ollama-host-form-actions {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  .ollama-host-form {
    grid-template-columns: minmax(0, 1fr);
  }

  .ollama-host-head {
    flex-direction: column;
  }

  .ollama-model-row {
    flex-wrap: wrap;
  }
}

.status-columns.is-single {
  grid-template-columns: minmax(0, 1fr);
}

.resource-section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.resource-section-head .section-title {
  font-size: 15px;
}

.resource-section-head .section-sub {
  margin-top: 3px;
  color: var(--faint);
  font-size: 10px;
}

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

.resource-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.resource-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.resource-card-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.resource-card-head strong {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 650;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.resource-bar {
  height: 6px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: var(--surface-3);
}

.resource-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.3s ease;
}

.resource-bar.is-warn span {
  background: var(--warning);
}

.resource-bar.is-danger span {
  background: var(--danger);
}

.resource-card-detail {
  margin-top: 8px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.resource-disk-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.resource-docker-system {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 12px;
}

.resource-docker-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 9px;
}

.resource-docker-pill strong {
  color: var(--ink);
  font-weight: 650;
}

.resource-table-wrap {
  max-height: 360px;
  border-top: 1px solid var(--line);
}

.resource-table-wrap .data-table th,
.resource-table-wrap .data-table td {
  font-size: 9.5px;
}

.resource-table-wrap .badge {
  margin-left: 5px;
  padding: 1px 5px;
  font-size: 7.5px;
}

.resource-db-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.resource-db-card {
  display: flex;
  flex-direction: column;
  gap: 11px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.resource-db-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.resource-db-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 650;
}

.resource-db-kind {
  margin-top: 2px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.resource-db-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.resource-db-metrics > div {
  min-width: 0;
  padding: 7px 8px;
  border-radius: var(--radius-xs);
  background: var(--surface-2);
}

.resource-db-metrics span {
  display: block;
  color: var(--faint);
  font-size: 8.5px;
}

.resource-db-metrics strong {
  display: block;
  margin-top: 2px;
  font-size: 10.5px;
  overflow-wrap: anywhere;
}

.resource-db-metrics small {
  display: block;
  color: var(--faint);
  font-size: 8.5px;
  overflow-wrap: anywhere;
}

.storage-section {
  margin-top: 16px;
}

.storage-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 20px;
  padding: 16px;
}

.storage-row {
  min-width: 0;
}

.storage-row-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 10.5px;
}

.storage-row-head span {
  color: var(--muted);
  font-weight: 600;
}

.storage-row-head strong {
  font-family: var(--font-mono);
  font-size: 10.5px;
  white-space: nowrap;
}

.storage-row .resource-bar {
  margin-top: 7px;
}

.storage-row-detail {
  margin-top: 5px;
  overflow: hidden;
  color: var(--faint);
  font-size: 9px;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.storage-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 16px 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--ink);
  font-size: 11px;
  font-weight: 650;
}

.storage-total strong {
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 19px;
}

@media (max-width: 1020px) {
  .status-layout {
    grid-template-columns: 208px minmax(0, 1fr);
  }

  .resource-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .status-layout {
    grid-template-columns: 1fr;
  }

  .status-sidebar {
    position: static;
  }

  .status-tab-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .resource-db-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .status-tab-list,
  .resource-grid,
  .resource-disk-grid,
  .storage-list {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ------------------------------------------------------------- animations */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse-dot {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.45;
  }
}

@keyframes menu-in {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(6px);
  }
}

/* ------------------------------------------------------------ responsive */
@media (max-width: 1180px) {
  .data-layout {
    grid-template-columns: 312px minmax(0, 1fr);
  }

  .rag-layout {
    grid-template-columns: 236px minmax(0, 1fr);
  }

  .rag-library {
    top: 118px;
  }

  .service-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .status-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1020px) {
  .rag-layout {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .arch-flow {
    grid-template-columns: 1fr 20px 1fr 20px 1fr 20px 1fr;
  }

  .header-status {
    display: none;
  }
}

@media (max-width: 900px) {
  .data-layout {
    grid-template-columns: 1fr;
  }

  .query-sidebar {
    position: static;
    max-height: none;
    overflow: visible;
  }

  .db-options {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .query-hint-grid {
    grid-template-columns: 1fr;
  }

  .rag-layout {
    grid-template-columns: 1fr;
  }

  .rag-library {
    position: static;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 14px;
    max-height: none;
  }

  .rag-new-chat,
  .rag-library-context,
  .rag-library-recent {
    grid-column: 1 / -1;
  }

  .status-columns {
    grid-template-columns: 1fr;
  }

  .arch-flow {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .arch-arrow {
    transform: rotate(90deg);
    padding: 2px 0;
  }

  .service-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1180px) {
  .app-header {
    flex-wrap: wrap;
    gap: 0 12px;
    height: auto;
    padding-top: 9px;
    padding-bottom: 0;
  }

  .brand {
    margin-bottom: 8px;
  }

  .header-actions {
    margin-bottom: 8px;
    margin-left: auto;
  }

  .primary-nav {
    order: 3;
    flex-basis: 100%;
    gap: 2px;
    margin: 0 -4px;
    padding-bottom: 8px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .primary-nav::-webkit-scrollbar {
    display: none;
  }

  .nav-link {
    flex: 1;
    justify-content: center;
    padding: 8px 10px;
    font-size: 12px;
  }
}

@media (max-width: 760px) {
  :root {
    --header-height: 60px;
  }

  .app-header {
    flex-wrap: wrap;
    gap: 0 12px;
    height: auto;
    padding-top: 9px;
    padding-bottom: 0;
  }

  .brand {
    margin-bottom: 8px;
  }

  .brand-copy strong {
    font-size: 12.5px;
  }

  .header-actions {
    margin-bottom: 8px;
    margin-left: auto;
  }

  .primary-nav {
    order: 3;
    flex-basis: 100%;
    gap: 2px;
    margin: 0 -4px;
    padding-bottom: 8px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .primary-nav::-webkit-scrollbar {
    display: none;
  }

  .nav-link {
    flex: 1;
    justify-content: center;
    padding: 8px 10px;
    font-size: 12px;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }

  .page-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .rag-title {
    font-size: clamp(1.85rem, 8vw, 2.6rem);
  }

  .ask-input {
    font-size: 15px;
  }

  .ask-hints {
    display: none;
  }

  .ask-footer {
    justify-content: flex-end;
  }

  .rag-library {
    grid-template-columns: 1fr;
  }

  .rag-followup {
    width: 100%;
  }

  .rag-user-bubble {
    max-width: 92%;
  }

  .db-options {
    grid-template-columns: 1fr 1fr;
  }

  .summary-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .summary-item:nth-child(2n) {
    border-right: 0;
  }

  .summary-item:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .report-grid {
    grid-template-columns: 1fr;
  }

  .report-grid .report-section + .report-section {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .report-head {
    flex-direction: column;
  }

  .report-actions {
    justify-content: flex-start;
  }

  .status-hero {
    flex-direction: column;
  }

  .status-actions {
    width: 100%;
    justify-content: space-between;
  }

  .status-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .skeleton-grid {
    grid-template-columns: 1fr;
  }

  .app-footer {
    font-size: 10px;
    padding-top: 22px;
  }

  .footer-main {
    gap: 20px;
  }

  .footer-links {
    gap: 20px 32px;
  }
}

@media (max-width: 560px) {
  .app-main {
    padding-top: 0;
    padding-bottom: 44px;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .service-grid {
    grid-template-columns: 1fr;
  }

  .mini-stats {
    grid-template-columns: repeat(3, 1fr);
  }

  .field-row {
    grid-template-columns: 1fr;
  }

  .multi-select {
    grid-template-columns: 1fr;
  }

  .citation {
    grid-template-columns: 24px minmax(0, 1fr);
  }

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

  .dist-row {
    grid-template-columns: 100px minmax(0, 1fr) auto;
  }

  .report-actions .btn span {
    display: none;
  }

  .report-actions .btn {
    width: 34px;
    padding: 0;
  }

  .status-summary {
    grid-template-columns: 1fr 1fr;
  }

  .endpoint-row {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .endpoint-label {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ------------------------------------------------------- theme flourishes */
[data-theme="nvidia"] .app-header {
  padding-top: 2px;
}

[data-theme="nvidia"] .brand-mark {
  border-radius: 0;
}

[data-theme="nvidia"] .card,
[data-theme="nvidia"] .report-card,
[data-theme="nvidia"] .query-sidebar {
  border-top-width: 2px;
}

[data-theme="nvidia"] .page-title,
[data-theme="nvidia"] .rag-title {
  text-transform: uppercase;
  letter-spacing: -0.02em;
}

[data-theme="ibm"] .app-header {
  padding-top: 2px;
}

[data-theme="ibm"] .brand-copy strong {
  font-weight: 600;
  letter-spacing: 0.12em;
}

[data-theme="ibm"] .data-table th {
  border-bottom: 2px solid var(--line-strong);
}

[data-theme="ibm"] .btn,
[data-theme="ibm"] .input,
[data-theme="ibm"] .select,
[data-theme="ibm"] .textarea,
[data-theme="ibm"] .card,
[data-theme="ibm"] .report-card,
[data-theme="ibm"] .query-sidebar,
[data-theme="ibm"] .rag-hero .ask-card {
  border-radius: 0;
}

[data-theme="figma"] .rag-title,
[data-theme="figma"] .page-title {
  text-wrap: balance;
}

[data-theme="figma"] .brand-mark {
  background: conic-gradient(
    from 210deg,
    #f24e1e,
    #ff7262,
    #a259ff,
    #1abcfe,
    #0acf83,
    #f24e1e
  );
  color: #ffffff;
}

[data-theme="figma"] .ask-card {
  border-width: 1.5px;
}

[data-theme="notion"] .page-title,
[data-theme="notion"] .rag-title,
[data-theme="notion"] .status-headline {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.01em;
}

[data-theme="notion"] .brand-copy strong {
  font-family: var(--font-display);
  letter-spacing: 0.08em;
}

[data-theme="stripe"] .rag-title,
[data-theme="stripe"] .page-title {
  font-weight: 600;
}

[data-theme="stripe"] .ask-card {
  border-color: rgba(99, 91, 255, 0.24);
}

[data-theme="linear"] .card,
[data-theme="linear"] .report-card,
[data-theme="linear"] .query-sidebar {
  background-image: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.012),
    transparent 120px
  );
}

[data-theme="linear"] .brand-mark {
  box-shadow: 0 0 24px rgba(94, 106, 210, 0.24);
}

[data-theme="apple"] .rag-title,
[data-theme="apple"] .page-title {
  font-weight: 700;
}

[data-theme="meta"] .btn-primary,
[data-theme="meta"] .btn-accent {
  border-radius: var(--radius-pill);
}

[data-theme="meta"] .nav-link.is-active {
  border-radius: var(--radius-pill);
}

[data-theme="openai"] .page-title,
[data-theme="openai"] .rag-title {
  font-weight: 600;
}

@media print {
  .app-header,
  .app-footer,
  .query-sidebar,
  .report-actions,
  .toast-region {
    display: none !important;
  }

  body {
    background: #ffffff;
  }

  body::before {
    display: none;
  }

  .data-layout {
    display: block;
  }

  .report-card {
    border: 0;
  }
}

/* ------------------------------------------------------ performance flow */
.perf-flow-stats {
  margin: 14px 0 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}

.perf-stat-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.perf-stat {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
}

.perf-stat-value {
  display: block;
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.25;
}

.perf-stat-label {
  display: block;
  margin-top: 3px;
  font-size: 9.5px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.perf-flow-stats-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
  gap: 12px;
  margin-top: 12px;
}

.perf-flow-stat-panel {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
}

.perf-model-list,
.perf-seg-list {
  display: grid;
  gap: 7px;
  margin-top: 8px;
}

.perf-model-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.perf-model-count {
  flex: none;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
}

.perf-seg-row {
  display: grid;
  grid-template-columns: minmax(100px, 0.8fr) minmax(60px, 1.2fr) auto;
  align-items: center;
  gap: 8px;
}

.perf-seg-name {
  overflow: hidden;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 9.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.perf-seg-track,
.flow-track {
  position: relative;
  height: 6px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--surface-3);
}

.perf-seg-track > span,
.flow-bar {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.perf-seg-ms {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9.5px;
  white-space: nowrap;
}

.perf-flow-list-head {
  margin: 18px 0 10px;
}

.perf-record-list {
  display: grid;
  gap: 9px;
}

.perf-record {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
}

.perf-record[open] {
  border-color: var(--accent-border);
}

.perf-record-summary {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) auto auto auto auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
}

.perf-record-summary::-webkit-details-marker {
  display: none;
}

.perf-record-summary:hover {
  background: var(--surface-2);
}

.perf-record-id {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
}

.perf-record-main {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.perf-record-title {
  overflow: hidden;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.perf-record-path {
  overflow: hidden;
  color: var(--muted);
  font-size: 9.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.perf-record-time {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9.5px;
  white-space: nowrap;
}

.perf-record-duration {
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.perf-record-chevron {
  display: inline-flex;
  color: var(--muted);
  transition: transform 160ms ease;
}

.perf-record[open] .perf-record-chevron {
  transform: rotate(90deg);
}

.perf-record-body {
  padding: 0 14px 14px;
  border-top: 1px solid var(--line);
}

.perf-flow-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 16px;
  padding: 10px 0;
  color: var(--muted);
  font-size: 9.5px;
}

.perf-flow-meta strong {
  color: var(--ink);
  font-weight: 600;
}

.perf-record-models {
  margin: 0 0 10px;
}

.flow-timeline {
  display: grid;
  gap: 8px;
  padding: 10px 0;
}

.flow-segment {
  min-width: 0;
  margin-left: calc(var(--depth, 0) * 16px);
  padding: 8px 10px 9px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface-2);
}

.flow-segment.is-error {
  border-left-color: var(--danger);
  background: var(--danger-soft);
}

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

.flow-seq {
  flex: none;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
}

.flow-segment-name {
  overflow: hidden;
  flex: 1;
  min-width: 0;
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flow-segment-start {
  flex: none;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  white-space: nowrap;
}

.flow-segment-duration {
  flex: none;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
}

.flow-segment-span {
  flex: none;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  white-space: nowrap;
}

.flow-segment-loc {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 1px 0 5px 25px;
  overflow: hidden;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  white-space: nowrap;
}

.flow-segment-loc-text {
  overflow: hidden;
  min-width: 0;
  text-overflow: ellipsis;
}

.flow-segment-mobile-cum {
  display: none;
  flex: none;
  color: var(--faint);
}

.flow-segment-dot {
  margin: 0 5px;
  opacity: 0.5;
}

.flow-track {
  height: 7px;
  margin-left: 25px;
}

.flow-bar {
  position: absolute;
  top: 0;
  min-width: 2px;
}

.flow-axis {
  display: flex;
  justify-content: space-between;
  margin: 2px 0 -4px;
  padding: 0 4px 0 25px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 8.5px;
}

.flow-bar.is-client {
  background: #65a30d;
}

.flow-bar.is-api {
  background: #3b82f6;
}

.flow-bar.is-rag {
  background: #8b5cf6;
}

.flow-bar.is-data {
  background: #d97706;
}

.flow-bar.is-index {
  background: #0d9488;
}

.flow-bar.is-other {
  background: var(--line-strong);
}

.flow-param-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 7px 0 0 25px;
}

.flow-param {
  display: inline-flex;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 8.5px;
  line-height: 1.5;
}

.flow-param-key {
  flex: none;
  padding: 1px 5px;
  color: var(--muted);
  background: var(--surface-2);
}

.flow-param-value {
  overflow: hidden;
  padding: 1px 5px;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flow-param-more {
  align-self: center;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8.5px;
}

.flow-segment-error {
  margin: 6px 0 0 25px;
  color: var(--danger);
  font-family: var(--font-mono);
  font-size: 9.5px;
}

.rag-wf-card {
  overflow: hidden;
}

.rag-wf-embedded {
  margin-top: 18px;
}

.rag-wf-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.rag-wf-actions {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.rag-wf-select {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 9px;
}

.rag-wf-select .select {
  min-width: 280px;
  max-width: min(520px, 70vw);
}

.rag-wf-summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 18px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
}

.rag-wf-summary strong {
  color: var(--ink);
  font-family: var(--font-mono);
  font-weight: 600;
}

.rag-wf-updating {
  color: var(--faint);
}

.rag-wf-axis {
  display: flex;
  justify-content: space-between;
  padding: 12px 20px 2px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 8.5px;
}

.rag-wf-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 4px 20px 7px;
  color: var(--faint);
  font-size: 8.5px;
}

.rag-wf-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.rag-wf-legend i {
  width: 12px;
  height: 6px;
  border-radius: 2px;
  background: var(--line-strong);
}

.rag-wf-legend i.is-load {
  background: #0ea5e9;
}

.rag-wf-stages {
  padding: 0 20px 12px;
}

.rag-wf-stage {
  border-bottom: 1px solid var(--line);
}

.rag-wf-stage:last-child {
  border-bottom: 0;
}

.rag-wf-stage-summary {
  display: block;
  padding: 9px 0 7px;
  cursor: pointer;
  list-style: none;
}

.rag-wf-stage-summary::-webkit-details-marker {
  display: none;
}

.rag-wf-stage-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.rag-wf-stage-label {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  min-width: 0;
}

.rag-wf-stage-label > i {
  width: 8px;
  height: 8px;
  margin-top: 4px;
  border-radius: 2px;
  background: var(--stage-color);
  flex: none;
}

.rag-wf-stage-label strong {
  display: block;
  color: var(--ink);
  font-size: 10.5px;
  line-height: 1.35;
}

.rag-wf-stage-label small {
  display: block;
  color: var(--faint);
  font-size: 8.5px;
  line-height: 1.4;
}

.rag-wf-stage-label .rag-wf-model-line {
  color: var(--accent);
  font-family: var(--font-mono);
}

.rag-wf-stage-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  white-space: nowrap;
}

.rag-wf-chevron {
  display: inline-flex;
  color: var(--faint);
  transition: transform 0.15s ease;
}

.rag-wf-stage[open] .rag-wf-chevron {
  transform: rotate(90deg);
}

.rag-wf-track {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: 4px;
  background-color: var(--surface-3);
  background-image: linear-gradient(
    90deg,
    var(--line) 1px,
    transparent 1px
  );
  background-size: 25% 100%;
}

.rag-wf-bar {
  position: absolute;
  min-width: 2px;
  border-radius: 2px;
  background: var(--bar-color, var(--stage-color));
}

.rag-wf-bar.is-sequential {
  min-width: 0;
}

.rag-wf-bar.is-load {
  background: var(--bar-color, #0ea5e9);
  box-shadow: inset -1px 0 rgba(255, 255, 255, 0.38);
}

.rag-wf-stage.is-error .rag-wf-bar {
  background: var(--danger);
}

.rag-wf-stage.is-missing .rag-wf-track {
  opacity: 0.55;
}

.rag-wf-stage.is-missing .rag-wf-stage-meta {
  color: var(--faint);
}

.rag-wf-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 5px 16px;
  padding: 0 0 11px 15px;
}

.rag-wf-details.is-split {
  display: block;
}

.rag-wf-detail-group + .rag-wf-detail-group {
  margin-top: 7px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}

.rag-wf-detail-group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 5px;
}

.rag-wf-detail-group-head strong {
  color: var(--ink);
  font-size: 9.5px;
  font-weight: 650;
}

.rag-wf-detail-group-head span {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 9px;
}

.rag-wf-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 5px 16px;
}

.rag-wf-detail {
  display: flex;
  gap: 6px;
  min-width: 0;
  font-size: 9.5px;
  line-height: 1.5;
}

.rag-wf-detail > span {
  flex: none;
  color: var(--faint);
  font-family: var(--font-mono);
}

.rag-wf-detail > strong {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-weight: 500;
}

.rag-wf-hint {
  margin: 0;
  padding: 0 20px 16px;
  color: var(--faint);
  font-size: 9.5px;
  line-height: 1.6;
}

.rag-wf-tooltip {
  position: fixed;
  z-index: 120;
  max-width: min(380px, calc(100vw - 24px));
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  line-height: 1.55;
  white-space: pre-line;
  pointer-events: none;
}

.rag-wf-tooltip[hidden] {
  display: none;
}

.flow-json {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.flow-json > summary,
.perf-query-details > summary {
  padding: 8px 10px;
  color: var(--muted);
  cursor: pointer;
  font-size: 10px;
  list-style: none;
}

.flow-json > summary::-webkit-details-marker,
.perf-query-details > summary::-webkit-details-marker {
  display: none;
}

.flow-json > summary::before,
.perf-query-details > summary::before {
  content: "▸";
  display: inline-block;
  width: 14px;
  color: var(--muted);
}

.flow-json[open] > summary::before,
.perf-query-details[open] > summary::before {
  content: "▾";
}

.flow-json pre,
.perf-no-flow pre {
  max-height: 360px;
  margin: 0;
  padding: 10px;
  overflow: auto;
  border-top: 1px solid var(--line);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 9px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.perf-no-flow {
  padding: 10px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--muted);
  font-size: 10.5px;
}

.perf-no-flow pre {
  max-height: 180px;
  margin-top: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
}

.perf-query-details {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-2);
}

.perf-query-details .query-box {
  margin: 0 10px 10px;
}

.perf-query-details .warnings {
  margin: 0 10px 10px;
}

@media (max-width: 980px) {
  .perf-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .perf-flow-stats-grid {
    grid-template-columns: 1fr;
  }

  .perf-record-summary {
    grid-template-columns: auto minmax(120px, 1fr) auto auto;
    gap: 7px 9px;
  }

  .perf-record-time,
  .perf-record-summary .badge {
    display: none;
  }
}

@media (max-width: 640px) {
  .perf-stat-grid {
    grid-template-columns: 1fr 1fr;
  }

  .perf-record-summary {
    grid-template-columns: auto minmax(0, 1fr) auto;
    padding: 10px;
  }

  .perf-record-duration {
    grid-column: 2;
    grid-row: 2;
  }

  .perf-record-chevron {
    grid-column: 3;
    grid-row: 1 / span 2;
  }

  .perf-record-list {
    gap: 7px;
  }

  .flow-segment {
    margin-left: calc(min(var(--depth, 0), 4) * 9px);
  }

  .flow-segment-loc,
  .flow-param-list,
  .flow-segment-error {
    margin-left: 0;
  }

  .flow-segment-span {
    display: none;
  }

  .flow-segment-mobile-cum {
    display: inline;
  }

  .flow-track {
    margin-left: 0;
  }

  .rag-wf-head,
  .rag-wf-summary,
  .rag-wf-axis,
  .rag-wf-stages,
  .rag-wf-hint {
    padding-left: 14px;
    padding-right: 14px;
  }

  .rag-wf-actions,
  .rag-wf-select {
    width: 100%;
  }

  .rag-wf-select .select {
    width: 100%;
    min-width: 0;
    max-width: none;
  }

  .rag-wf-details {
    grid-template-columns: 1fr;
    padding-left: 15px;
    padding-right: 0;
  }
}

.performance-flow-report .summary-strip {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

@media (max-width: 980px) {
  .performance-flow-report .summary-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .performance-flow-report .summary-item:nth-child(2n) {
    border-right: 0;
  }

  .performance-flow-report .summary-item:nth-child(5) {
    grid-column: 1 / -1;
    border-right: 0;
  }
}

/* ------------------------------------------------------ index performance */
.index-perf-panel {
  margin: 14px 18px 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}

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

.index-perf-sub {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.index-perf-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.index-perf-stat {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
}

.index-perf-value {
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.index-perf-note {
  margin-top: 3px;
  color: var(--faint);
  font-size: 9.5px;
  line-height: 1.45;
}

.index-perf-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 16px;
  margin-top: 12px;
  padding: 9px 11px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.index-perf-meta strong {
  color: var(--ink);
  font-weight: 600;
}

.index-charts {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 12px;
  margin-top: 12px;
}

.index-chart-card {
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
}

.index-chart-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 10.5px;
  font-weight: 600;
}

.index-chart-head span:last-child {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
}

.index-run-bars {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.index-run-row {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) 118px;
  align-items: center;
  gap: 9px;
}

.index-run-label {
  min-width: 0;
}

.index-run-label strong {
  display: block;
  color: var(--ink);
  font-size: 9.5px;
  font-weight: 600;
}

.index-run-label span {
  display: block;
  overflow: hidden;
  color: var(--faint);
  font-size: 8.5px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.index-run-track {
  height: 8px;
  overflow: hidden;
  border-radius: 4px;
  background: var(--surface-3);
}

.index-run-track span {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent), var(--info));
}

.index-run-value {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  column-gap: 3px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.index-run-value strong {
  font-size: 12px;
  font-weight: 700;
}

.index-run-value span {
  color: var(--muted);
  font-size: 8.5px;
}

.index-run-value em {
  grid-column: 1 / -1;
  overflow: hidden;
  color: var(--faint);
  font-size: 8.5px;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.index-breakdown-bar {
  display: flex;
  height: 14px;
  margin-top: 6px;
  overflow: hidden;
  border-radius: 7px;
  background: var(--surface-3);
}

.index-seg {
  display: block;
  height: 100%;
}

.index-seg-embedding {
  background: var(--accent);
}

.index-seg-qdrant {
  background: var(--info);
}

.index-seg-db {
  background: var(--success);
}

.index-seg-other {
  background: var(--faint);
}

.index-breakdown-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-top: 9px;
}

.index-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 9px;
}

.index-legend-item i {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.index-legend-item strong {
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
}

.index-legend-item em {
  color: var(--faint);
  font-style: normal;
}

.index-chart-empty {
  padding: 8px 0 4px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.65;
}

.index-pipeline-panel {
  margin-top: 0;
}

.index-pipeline-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.index-pipeline-select {
  min-width: 260px;
  max-width: 420px;
}

.index-pipeline-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 16px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 9.5px;
}

.index-pipeline-meta strong {
  margin-right: 3px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.index-pipeline-bar {
  display: flex;
  height: 14px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 7px;
  background: var(--surface-3);
}

.index-pipeline-seg {
  display: block;
  height: 100%;
  min-width: 1px;
}

.index-pipeline-list {
  margin-top: 10px;
  border-top: 1px solid var(--line);
}

.index-pipeline-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.index-pipeline-step {
  padding-top: 2px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 9px;
}

.index-pipeline-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.index-pipeline-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.index-pipeline-title strong {
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 650;
}

.index-pipeline-detail {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.index-pipeline-host {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 9px;
}

.index-pipeline-time {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  text-align: right;
}

.index-pipeline-time strong {
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
}

.index-pipeline-time span {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 9px;
}

@media (max-width: 640px) {
  .index-pipeline-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .index-pipeline-select {
    flex: 1 1 180px;
    min-width: 0;
    max-width: none;
  }

  .index-pipeline-row {
    grid-template-columns: 22px minmax(0, 1fr) auto;
    gap: 7px;
  }
}

.index-progress-card {
  margin-top: 12px;
}

.index-progress-svg {
  display: block;
  width: 100%;
  height: 150px;
  margin-top: 4px;
}

.index-progress-area {
  fill: var(--accent-soft);
}

.index-progress-line {
  fill: none;
  stroke: var(--accent);
  stroke-linejoin: round;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.index-progress-svg circle {
  fill: var(--accent);
}

.index-chart-grid {
  stroke: var(--line);
  stroke-dasharray: 3 4;
}

.index-chart-axis {
  stroke: var(--line-strong);
}

.index-progress-labels {
  display: flex;
  justify-content: space-between;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 9px;
}

@media (max-width: 980px) {
  .index-perf-panel {
    margin-right: 0;
    margin-left: 0;
  }

  .index-perf-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .index-charts {
    grid-template-columns: minmax(0, 1fr);
  }

  .index-run-row {
    grid-template-columns: 78px minmax(0, 1fr) 100px;
  }
}

/* ------------------------------------------------------ test mode flow */
.test-run-summary {
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid var(--accent-border);
  border-radius: 9px;
  background: var(--accent-soft);
  font-size: 10.5px;
}

.test-run-summary-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 10px;
  color: var(--muted);
}

.test-run-summary-body {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  color: var(--muted);
}

.test-run-summary-body a {
  color: var(--accent);
  font-weight: 600;
}

.test-flow-panel {
  margin-bottom: 16px;
  padding: 16px 18px 14px;
  border-color: var(--accent-border);
}

.test-flow-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.test-flow-heading {
  min-width: 0;
}

.test-flow-title {
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 1.15rem;
  font-weight: 700;
}

.test-flow-question {
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.test-flow-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.test-flow-select-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 10px;
}

.test-flow-select-label .select {
  min-width: 210px;
  max-width: 330px;
}

.test-flow-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: 12px 0 14px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 9.5px;
}

.test-flow-meta strong {
  color: var(--ink);
  font-weight: 600;
}

.test-flow-stages {
  display: grid;
  gap: 10px;
}

.test-flow-stage {
  min-width: 0;
  padding: 9px 10px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-2);
}

.test-flow-stage-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
}

.test-flow-stage-title {
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
}

.test-flow-stage-meta {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
}

.test-flow-stage-steps {
  display: grid;
  gap: 7px;
}

.test-flow-step {
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
}

.test-flow-step.is-running {
  border-left-color: var(--info);
}

.test-flow-step.is-success {
  border-left-color: #65a30d;
}

.test-flow-step.is-failed {
  border-left-color: var(--danger);
  background: var(--danger-soft);
}

.test-flow-step.is-skipped {
  opacity: 0.72;
}

.test-flow-step-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.test-flow-model {
  overflow: hidden;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.test-flow-step-meta {
  flex: none;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
}

.test-flow-track {
  position: relative;
  height: 7px;
  margin-top: 5px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--surface-3);
}

.test-flow-bar {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #94a3b8;
  transition: width 320ms ease;
}

.test-flow-step.is-running .test-flow-bar {
  background: var(--info);
  animation: test-flow-pulse 1.1s ease-in-out infinite alternate;
}

.test-flow-step.is-success .test-flow-bar {
  background: #65a30d;
}

.test-flow-step.is-failed .test-flow-bar {
  background: var(--danger);
}

.test-flow-step.is-skipped .test-flow-bar {
  background: var(--line-strong);
}

.test-flow-error {
  margin-top: 4px;
  color: var(--danger);
  font-size: 9px;
  line-height: 1.4;
}

.test-flow-details {
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.test-flow-total {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.test-flow-total-head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  color: var(--ink);
  font-size: 10.5px;
  font-weight: 650;
}

.test-flow-track.is-total {
  height: 10px;
  background: var(--surface-3);
}

.test-flow-bar.is-total {
  background: var(--accent);
}

.test-flow-track.is-running .test-flow-bar.is-total {
  animation: test-flow-pulse 1.1s ease-in-out infinite alternate;
}

.test-flow-foot {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
  color: var(--muted);
  font-size: 9.5px;
}

.test-flow-panel .empty-state {
  margin-top: 8px;
}

@keyframes test-flow-pulse {
  from {
    opacity: 0.55;
  }
  to {
    opacity: 1;
  }
}

@media (max-width: 720px) {
  .test-flow-panel {
    padding: 12px;
  }

  .test-flow-head {
    flex-direction: column;
  }

  .test-flow-actions {
    width: 100%;
  }

  .test-flow-select-label {
    flex: 1;
    min-width: 0;
  }

  .test-flow-select-label .select {
    width: 100%;
    min-width: 0;
  }

  .test-flow-question {
    white-space: normal;
  }
}

.test-flow-time {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.test-flow-time-bar {
  display: flex;
  width: 100%;
  height: 26px;
  overflow: hidden;
  border-radius: 8px;
  background: var(--surface-3);
}

.test-flow-time-seg {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  overflow: hidden;
  border-right: 1px solid rgba(255, 255, 255, 0.45);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
  white-space: nowrap;
  transition: width 320ms ease;
}

.test-flow-time-seg:last-child {
  border-right: 0;
}

.test-flow-time-seg.stage-embedding,
.test-flow-dot.stage-embedding {
  background: #0ea5e9;
}

.test-flow-time-seg.stage-retrieval,
.test-flow-dot.stage-retrieval {
  background: #f59e0b;
}

.test-flow-time-seg.stage-context,
.test-flow-dot.stage-context {
  background: #64748b;
}

.test-flow-time-seg.stage-llm,
.test-flow-dot.stage-llm {
  background: #8b5cf6;
}

.test-flow-time-seg.stage-validation,
.test-flow-dot.stage-validation {
  background: #22c55e;
}

.test-flow-time-seg.stage-overhead,
.test-flow-dot.stage-overhead {
  background: #94a3b8;
}

.test-flow-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 14px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 9px;
}

.test-flow-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.test-flow-legend-item strong {
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 650;
}

.test-flow-legend-item em {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-style: normal;
}

.test-flow-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.test-flow-time-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  color: var(--muted);
  font-size: 9px;
}

.test-flow-time-note {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
}

@media (max-width: 640px) {
  .test-flow-time-bar {
    height: 22px;
  }

  .test-flow-time-seg {
    font-size: 7.5px;
  }

  .test-flow-legend {
    gap: 4px 10px;
  }
}

.rag-test-flow {
  margin-top: 18px;
}

.test-flow-answer {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-2);
}

.test-flow-answer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: 0.03em;
}

.test-flow-answer p {
  color: var(--ink);
  font-size: 11px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.test-flow-step-loc {
  margin: 1px 0 5px;
  overflow: hidden;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .rag-test-flow {
    margin-top: 12px;
  }
}

.perf-flow-qa {
  margin: 0 0 10px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.perf-flow-qa-row {
  display: flex;
  gap: 8px;
  color: var(--ink);
  font-size: 10.5px;
  line-height: 1.6;
}

.perf-flow-qa-row + .perf-flow-qa-row {
  margin-top: 5px;
  padding-top: 5px;
  border-top: 1px dashed var(--line);
}

.perf-flow-qa-row strong {
  flex: none;
  min-width: 58px;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 650;
}

.perf-flow-qa-row span {
  min-width: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.citation-links {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
}

.citation-links .citation-link {
  font-size: 12px;
}

.citation-body[data-action],
.citation-head[data-action] {
  border-radius: 6px;
  cursor: pointer;
}

.citation-body[data-action]:hover .citation-name,
.citation-body[data-action]:focus-visible .citation-name,
.citation-head[data-action]:hover .citation-name,
.citation-head[data-action]:focus-visible .citation-name {
  color: var(--accent);
}

.citation-body[data-action]:focus-visible,
.citation-head[data-action]:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.judgment-dialog {
  width: min(980px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.35);
}

.judgment-dialog::backdrop {
  background: rgba(15, 23, 42, 0.62);
}

.judgment-dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.judgment-dialog-head h2 {
  margin: 2px 0 0;
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
}

.judgment-dialog-close {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}

.judgment-dialog-close:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}

.judgment-dialog-body {
  max-height: calc(100vh - 180px);
  padding: 14px 18px 16px;
  overflow: auto;
  overscroll-behavior: contain;
  scroll-behavior: auto;
  scrollbar-gutter: stable;
}

.judgment-dialog-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  color: var(--muted);
  font-size: 10px;
}

.judgment-dialog-source {
  margin: 6px 0 8px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
}

.judgment-dialog-text {
  max-height: 55vh;
  margin: 0;
  padding: 14px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 23px;
  line-height: 1.8;
  white-space: pre-wrap;
  word-break: break-word;
}

.judgment-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

.law-dialog-articles {
  margin-top: 10px;
  overflow: visible;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-2);
  overscroll-behavior: contain;
}

.law-dialog .law-article {
  padding: 10px 12px;
}

.law-dialog .law-article-no {
  font-size: 16px;
}

.law-dialog .law-article-text {
  font-size: 16px;
  line-height: 1.7;
}

.law-dialog-warning {
  margin-top: 8px;
  padding: 8px 10px;
  border-left: 2px solid var(--warning);
  border-radius: 0 6px 6px 0;
  background: var(--warning-soft);
  color: var(--muted);
  font-size: 10px;
  line-height: 1.6;
}

.law-dialog-history {
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-2);
}

.law-dialog-history summary {
  color: var(--muted);
  cursor: pointer;
  font-size: 10px;
  font-weight: 650;
}

.law-dialog-history > div {
  max-height: 180px;
  margin-top: 6px;
  overflow: auto;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.judgment-dialog-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 36px 8px;
  color: var(--muted);
  font-size: 11px;
}

@media (max-width: 640px) {
  .citation-links {
    grid-column: 2;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .judgment-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 20px);
  }

  .judgment-dialog-body {
    max-height: calc(100vh - 150px);
    padding: 12px;
  }

  .judgment-dialog-text {
    max-height: 52vh;
    padding: 10px;
    font-size: 22px;
  }
}

/* ---------------------------------------------------------- processing page */
.processing-actions {
  align-items: center;
  gap: 8px;
}

.processing-page-heading {
  min-width: 0;
}

.processing-title-line {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 14px;
}

.processing-title-line .page-title {
  flex: none;
}

.processing-page-subtitle {
  max-width: none;
  margin-top: 0;
  font-size: 12.5px;
  line-height: 1.5;
}

.processing-stop[hidden] {
  display: none;
}

.processing-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 36px 16px;
  color: var(--muted);
  font-size: 12px;
}

.processing-notices {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.processing-notices .notice {
  margin: 0;
}

.processing-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
  gap: 10px;
  margin: 2px 0 18px;
}

.processing-summary-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.processing-summary-label {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.processing-summary-value {
  color: var(--ink);
  font-size: 15px;
  font-weight: 650;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
}

.processing-summary-hint {
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.5;
}

.processing-summary-card.is-ratio .processing-summary-value {
  color: var(--accent);
}

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

.processing-flow-section {
  margin: 18px 0;
}

.processing-section-sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.6;
}

.processing-card .report-section-title,
.processing-flow-section .report-section-title {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
  text-transform: none;
}

.processing-card {
  margin-bottom: 16px;
}

/* Open, frameless pipeline canvas */
.flow-canvas-open {
  position: relative;
  overflow-x: auto;
  padding: 22px 18px 28px;
  background:
    radial-gradient(900px 340px at 8% -10%, rgba(167, 139, 250, 0.16), transparent 62%),
    radial-gradient(780px 340px at 92% -6%, rgba(244, 114, 182, 0.1), transparent 60%);
  color: inherit;
}

.flow-canvas-open::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(
    rgba(15, 23, 42, 0.16) 0.7px,
    transparent 0.9px
  );
  background-size: 22px 22px;
  opacity: 0.32;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.95),
    transparent 96%
  );
  mask-image: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.95),
    transparent 96%
  );
}

.processing-branches {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 26px;
  align-items: start;
}

.flow-lane {
  min-width: 0;
}

.flow-row {
  display: flex;
  align-items: stretch;
  min-width: max-content;
  padding: 2px 0 4px;
}

.flow-source,
.flow-node {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 184px;
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, 0.22);
  border-radius: 13px;
  background: #f8fafc;
  box-shadow: 0 20px 42px -30px rgba(0, 0, 0, 0.98),
    0 2px 7px rgba(0, 0, 0, 0.2);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.flow-source {
  flex: 0 0 clamp(136px, 11vw, 160px);
}

.flow-node {
  flex: 0 0 clamp(136px, 11.2vw, 162px);
}

.flow-source:hover,
.flow-node:hover {
  transform: translateY(-2px);
  border-color: rgba(167, 139, 250, 0.5);
}

.flow-source.is-live {
  border-color: var(--branch-accent, #a78bfa);
  box-shadow: 0 0 0 1px var(--branch-accent, #a78bfa),
    0 18px 44px -24px var(--branch-accent, #a78bfa);
}

.flow-node.is-live {
  border-color: var(--stage-color, #a78bfa);
  box-shadow: 0 0 0 1px var(--stage-color, #a78bfa),
    0 18px 44px -24px var(--stage-color, #a78bfa);
}

.flow-source-head,
.flow-node-head {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  padding: 7px 8px;
  background: linear-gradient(180deg, #132b52 0%, #0a1a36 100%);
}

.flow-source-head {
  box-shadow: inset 0 -2px 0 var(--branch-accent, #a78bfa);
}

.flow-node-head {
  box-shadow: inset 0 -2px 0 var(--stage-color, #a78bfa);
}

.flow-node-icon,
.flow-source-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 23px;
  height: 23px;
  border: 1px solid rgba(255, 255, 255, 0.17);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--stage-color, #a78bfa);
  flex: none;
}

.flow-source-icon {
  color: var(--branch-accent, #a78bfa);
}

.flow-node-heading {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.flow-node-kicker {
  color: #9fb0cc;
  font-family: var(--font-mono);
  font-size: 6.4px;
  font-weight: 600;
  letter-spacing: 0.12em;
}

.flow-node-heading strong {
  display: -webkit-box;
  overflow: hidden;
  color: #f8fafc;
  font-size: 9.5px;
  font-weight: 650;
  line-height: 1.2;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.flow-source-body,
.flow-node-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 7px;
  min-height: 0;
  padding: 9px;
  background: #f8fafc;
}

.flow-source-desc {
  margin: 0;
  color: #475569;
  font-size: 8px;
  line-height: 1.45;
}

.flow-source-meta {
  overflow-wrap: anywhere;
  color: #64748b;
  font-family: var(--font-mono);
  font-size: 7.4px;
  line-height: 1.45;
}

.flow-source-current {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  align-self: flex-start;
  padding: 3px 6px;
  border: 1px solid #c7d2fe;
  border-radius: var(--radius-pill);
  background: #eef2ff;
  color: #4338ca;
  font-size: 7.2px;
}

.flow-source-current strong {
  color: #312e81;
  font-weight: 650;
}

.flow-current-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--branch-accent, #a78bfa);
  box-shadow: 0 0 6px var(--branch-accent, #a78bfa);
  animation: processing-current-pulse 1.6s ease-in-out infinite;
}

.flow-source-note {
  max-height: 3.1em;
  margin-top: auto;
  overflow: hidden;
  padding-top: 6px;
  border-top: 1px dashed #dbe3ee;
  color: #64748b;
  font-size: 7.4px;
  line-height: 1.45;
}

.flow-link {
  position: relative;
  z-index: 2;
  display: flex;
  flex: 0 0 clamp(18px, 1.7vw, 24px);
  align-self: stretch;
  align-items: center;
  justify-content: center;
  color: #a78bfa;
  filter: drop-shadow(0 0 4px currentColor);
}

.flow-link svg {
  display: block;
  overflow: visible;
  flex: none;
}

.flow-link.is-live {
  filter: drop-shadow(0 0 5px currentColor) drop-shadow(0 0 12px currentColor);
}

.flow-link-line {
  stroke-linecap: round;
}

.flow-link.is-live .flow-link-line {
  stroke-dasharray: 5 5;
  animation: flow-link-dash 0.9s linear infinite;
}

.flow-link-port {
  fill: #07070b;
}

@keyframes flow-link-dash {
  to {
    stroke-dashoffset: -10;
  }
}

.flow-node .processing-bar {
  height: 5px;
  background: #e2e8f0;
}

.flow-node .processing-bar-fill {
  transition: width 0.35s ease;
}

.flow-node-props {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.flow-prop {
  min-width: 0;
  padding: 4px 5px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #ffffff;
}

.flow-prop span {
  display: block;
  color: #64748b;
  font-family: var(--font-mono);
  font-size: 6.2px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.flow-prop strong {
  display: block;
  margin-top: 1px;
  overflow: hidden;
  color: #0f172a;
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flow-node-note {
  max-height: 2.9em;
  overflow: hidden;
  color: #64748b;
  font-size: 7.4px;
  line-height: 1.45;
}

.flow-status {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: auto;
  padding: 2px 5px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.04);
  color: #a1a1aa;
  font-size: 7px;
  font-weight: 600;
  white-space: nowrap;
  flex: none;
}

.flow-status-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 6px currentColor;
}

.flow-status.is-ok {
  color: #86efac;
  border-color: rgba(74, 222, 128, 0.26);
  background: rgba(34, 197, 94, 0.08);
}

.flow-status.is-warn {
  color: #fcd34d;
  border-color: rgba(251, 191, 36, 0.26);
  background: rgba(245, 158, 11, 0.08);
}

.flow-status.is-danger {
  color: #fda4af;
  border-color: rgba(251, 113, 133, 0.26);
  background: rgba(244, 63, 94, 0.08);
}

.flow-status.is-info {
  color: #c4b5fd;
  border-color: rgba(167, 139, 250, 0.28);
  background: rgba(124, 58, 237, 0.12);
}

.flow-status.is-idle {
  color: #a1a1aa;
}

.flow-empty {
  padding: 18px 10px;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  color: #8b8b9a;
  font-size: 9px;
  text-align: center;
}

.processing-stage {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.processing-stage.is-compact {
  padding: 8px 9px;
}

.processing-stage.is-live {
  border-color: var(--stage-color, var(--accent));
  box-shadow: 0 0 0 1px var(--stage-color, var(--accent)),
    0 10px 24px -18px var(--stage-color, var(--accent));
}

.processing-stage.is-live .processing-stage-swatch {
  animation: processing-current-pulse 1.6s ease-in-out infinite;
}

@keyframes processing-current-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

.processing-stage-head {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  margin-bottom: 6px;
}

.processing-stage-swatch {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: none;
}

.processing-stage-label {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 10.5px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.processing-stage-head .badge {
  flex: none;
  margin-left: auto;
  padding: 1px 6px;
  font-size: 8.5px;
}

.processing-stage-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 9.5px;
}

.processing-stage-message {
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.processing-stage-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 12px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--line);
}

.processing-stage-stat {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  color: var(--muted);
  font-size: 9px;
}

.processing-stage-stat strong {
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
}

.processing-bar {
  position: relative;
  display: block;
  height: 6px;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: var(--surface-3);
}

.processing-bar-lg {
  height: 9px;
}

.processing-bar-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  transition: width 0.35s ease;
}

.processing-bar.is-indeterminate {
  background:
    repeating-linear-gradient(
      135deg,
      transparent 0,
      transparent 4px,
      color-mix(in srgb, var(--line) 80%, transparent) 4px,
      color-mix(in srgb, var(--line) 80%, transparent) 5px
    ),
    var(--surface-3);
}

.processing-bar.is-indeterminate .processing-bar-fill {
  display: none;
}

.processing-archive-summary {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-2);
}

.processing-archive-summary-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 10px;
}

.processing-archive-summary-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 6px;
  color: var(--muted);
  font-size: 9.5px;
}

.processing-archive-run {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 11px;
  color: var(--muted);
  font-size: 9.5px;
}

.processing-archive-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 10px;
}

.processing-archive {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.processing-archive.is-info {
  border-left-color: var(--accent);
}

.processing-archive.is-ok {
  border-left-color: var(--success);
}

.processing-archive.is-warn {
  border-left-color: var(--warning);
}

.processing-archive.is-danger {
  border-left-color: var(--danger);
}

.processing-archive-head {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.processing-archive-name {
  flex: 0 1 340px;
  min-width: 150px;
  overflow: hidden;
  color: var(--ink);
  font-size: 10px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.processing-archive-bar-wrap {
  flex: 1 1 120px;
  min-width: 70px;
}

.processing-archive-percent {
  width: 54px;
  color: var(--muted);
  font-size: 9.5px;
  text-align: right;
  flex: none;
}

.processing-archive-head .badge {
  flex: none;
}

.processing-archive-size {
  margin-left: auto;
  font-size: 9px;
  white-space: nowrap;
  flex: none;
}

.processing-archive-stages {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 7px;
}

.processing-archive-note {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 9px;
}

.processing-timeline-label {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 10px;
}

.processing-stack {
  display: flex;
  height: 18px;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: var(--surface-3);
}

.processing-stack-segment {
  display: block;
  min-width: 2px;
  height: 100%;
}

.processing-legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(225px, 1fr));
  gap: 6px 18px;
  margin-top: 10px;
}

.processing-legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 9.5px;
}

.processing-legend-swatch {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex: none;
}

.processing-legend-label {
  min-width: 76px;
  color: var(--ink);
}

.processing-legend-percent {
  margin-left: auto;
}

.processing-run-list {
  display: flex;
  flex-direction: column;
}

.processing-run {
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.processing-run:first-child {
  padding-top: 0;
}

.processing-run:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.processing-run-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 10px;
}

.processing-run-message {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.55;
}

.processing-empty {
  padding: 18px 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.6;
  text-align: center;
}

.processing-error-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

@media (max-width: 1120px) {
  .processing-branches {
    grid-template-columns: 1fr;
  }

  .processing-archive-stages {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .processing-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .processing-summary {
    grid-template-columns: 1fr 1fr;
  }

  .processing-archive-head {
    flex-wrap: wrap;
  }

  .processing-archive-name {
    flex-basis: 100%;
    max-width: none;
    white-space: normal;
    word-break: break-all;
  }

  .processing-archive-bar-wrap {
    flex: 1 1 100px;
  }

  .processing-archive-size {
    margin-left: 0;
  }
}

@media (max-width: 480px) {
  .processing-summary {
    grid-template-columns: 1fr;
  }

  .processing-stack {
    height: 14px;
  }

  .answer-head-meta {
    order: 2;
  }

  .rag-process-control {
    order: 3;
    flex: 1 0 100%;
    justify-content: space-between;
    margin-right: 0;
  }
}

/* ---------------------------------------------------------- system tests */
.tests-page .page-header {
  align-items: flex-start;
}

.tests-page-embedded {
  min-width: 0;
}

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

.tests-embed-head .page-actions {
  flex: none;
}

.tests-embed-title {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 2vw, 1.8rem);
  font-weight: var(--display-weight, 650);
  letter-spacing: var(--display-tracking, -0.02em);
}

.tests-embed-copy {
  max-width: 720px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.6;
}

.tests-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 16px;
  align-items: start;
  margin-bottom: 16px;
}

.tests-card {
  min-width: 0;
  padding: clamp(16px, 2vw, 22px);
}

.tests-api-form {
  gap: 14px;
  padding: 0;
}

.tests-card-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.tests-card-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
}

.tests-card-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.015em;
}

.tests-card-copy {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.6;
}

.tests-mode-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
}

.test-mode-switch {
  width: 70px;
  height: 30px;
  flex: none;
}

.tests-mode-summary {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.tests-models {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.tests-model-group {
  display: grid;
  gap: 5px;
}

.tests-model-label {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.tests-model-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.tests-model-empty {
  color: var(--faint);
  font-size: 10.5px;
}

.tests-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.tests-status {
  margin-top: 12px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.6;
}

.tests-status:empty {
  display: none;
}

.tests-status.is-ok {
  border-color: transparent;
  background: var(--success-soft);
  color: var(--success);
}

.tests-status.is-error {
  border-color: transparent;
  background: var(--danger-soft);
  color: var(--danger);
}

.tests-status.is-warn {
  border-color: transparent;
  background: var(--warning-soft);
  color: var(--ink);
}

.tests-page #tests-flow {
  margin-top: 16px;
}

.tests-llm-card {
  margin-bottom: 16px;
}

.tests-llm-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-top: 16px;
}

.tests-llm-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  flex: 1;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.tests-llm-summary strong {
  color: var(--ink);
  font-family: var(--font-mono);
}

.tests-llm-summary .muted {
  flex-basis: 100%;
}

.tests-llm-list {
  margin-top: 14px;
  border-top: 1px solid var(--line);
}

.tests-llm-row {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.tests-llm-model {
  min-width: 0;
}

.tests-llm-model strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11.5px;
  font-weight: 600;
}

.tests-llm-model small {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 10px;
}

.tests-llm-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.tests-llm-time {
  color: var(--faint);
  font-size: 10px;
}

.tests-llm-empty {
  padding: 16px 0;
  color: var(--muted);
  font-size: 11px;
}

.tests-llm-failures {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--warning-soft);
  color: var(--ink);
  font-size: 10.5px;
  line-height: 1.6;
}

.tests-rerank-result {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.tests-rerank-result .mono {
  color: var(--ink);
  font-size: 9.5px;
}

@media (max-width: 900px) {
  .tests-grid {
    grid-template-columns: 1fr;
  }

  .tests-embed-head {
    flex-direction: column;
  }

  .tests-embed-head .page-actions {
    width: 100%;
    justify-content: space-between;
  }

  .tests-llm-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

@media (max-width: 480px) {
  .tests-mode-row {
    flex-wrap: wrap;
  }

  .tests-api-form .api-dialog-actions .grow {
    display: none;
  }

  .tests-llm-head {
    flex-direction: column;
  }

  .tests-llm-head .btn {
    width: 100%;
    justify-content: center;
  }
}

/* ------------------------------------------------------- data workflows */
.processing-layout {
  align-items: start;
}

.processing-sidebar {
  top: 86px;
}

.processing-workflow-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.processing-update-notice {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 9px 11px;
  border: 1px solid var(--warning);
  border-radius: var(--radius-card);
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 11px;
}

.processing-update-notice-icon {
  display: inline-flex;
  flex: none;
  margin-top: 1px;
}

.processing-update-notice-copy {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.processing-update-notice-copy strong {
  font-size: 11.5px;
  font-weight: 700;
}

.processing-update-mechanism,
.processing-update-message {
  color: color-mix(in srgb, var(--warning) 78%, var(--ink) 22%);
  font-size: 10px;
  line-height: 1.5;
}

.processing-update-message {
  color: var(--ink);
  opacity: 0.82;
}

.processing-update-notice .badge {
  flex: none;
  margin-left: auto;
}

.processing-update-count {
  gap: 4px;
}

.processing-update-count svg {
  flex: none;
}

.processing-run-strip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 16px 12px;
  padding: 8px 10px;
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-sm, 6px);
  background: var(--accent-soft);
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.processing-run-strip .badge {
  flex: none;
}

.processing-run-strip strong {
  color: var(--ink);
}

.processing-workflow-history {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.processing-workflow-history-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm, 6px);
  background: var(--surface-2, transparent);
  font-size: 10px;
}

.processing-workflow-history-status {
  display: inline-flex;
  flex: none;
}

.processing-workflow-history-message {
  flex: 1 1 180px;
  min-width: 0;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.processing-workflow-progress-card {
  overflow: visible;
}

.processing-workflow-stage-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.processing-workflow-stage {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm, 6px);
  background: var(--surface-2, transparent);
  cursor: help;
  transition: opacity 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.processing-workflow-stage.is-running {
  border-color: var(--stage-color, var(--accent));
  box-shadow: 0 0 0 1px var(--stage-color, var(--accent));
}

.processing-workflow-stage.is-stage-hovered {
  border-color: var(--stage-color, var(--accent));
  box-shadow: 0 0 0 1px var(--stage-color, var(--accent));
}

.processing-workflow-stage-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.processing-workflow-stage .is-failure-tip,
.workflow-wf-stage .is-failure-tip {
  position: relative;
  cursor: help;
}

.processing-workflow-stage .is-failure-tip::after,
.workflow-wf-stage .is-failure-tip::after {
  content: attr(data-failure-tip);
  position: absolute;
  left: 0;
  bottom: calc(100% + 7px);
  z-index: 90;
  display: none;
  width: max-content;
  max-width: min(360px, calc(100vw - 24px));
  padding: 8px 10px;
  border: 1px solid var(--danger);
  border-radius: 7px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  color: var(--ink);
  font-size: 9.5px;
  font-weight: 500;
  line-height: 1.55;
  white-space: pre-line;
  text-align: left;
  pointer-events: none;
}

.processing-workflow-stage .is-failure-tip:hover::after,
.processing-workflow-stage .is-failure-tip:focus::after,
.processing-workflow-stage .is-failure-tip:focus-visible::after,
.workflow-wf-stage .is-failure-tip:hover::after,
.workflow-wf-stage .is-failure-tip:focus::after,
.workflow-wf-stage .is-failure-tip:focus-visible::after {
  display: block;
}

@media (max-width: 720px) {
  .processing-workflow-stage .is-failure-tip::after,
  .workflow-wf-stage .is-failure-tip::after {
    left: 50%;
    transform: translateX(-50%);
  }
}

.processing-workflow-stage-swatch,
.processing-workflow-progress-swatch,
.processing-stage-tooltip-swatch {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 3px;
  background: var(--stage-color, var(--accent));
}

.processing-workflow-stage.is-running .processing-workflow-stage-swatch {
  animation: processing-current-pulse 1.6s ease-in-out infinite;
}

.processing-workflow-stage-label {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 11px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.processing-workflow-stage-percent {
  margin-left: auto;
  color: var(--stage-color, var(--accent));
  font-size: 10px;
  font-weight: 600;
}

.processing-workflow-stage-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  color: var(--faint);
  font-size: 9.5px;
}

.processing-workflow-stage-message {
  flex: 1 1 180px;
  min-width: 0;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.processing-financial-ratio {
  display: inline-flex;
  flex: none;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 7px;
  margin-left: auto;
  padding-left: 10px;
  border-left: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}

.processing-financial-ratio strong {
  color: var(--ink);
  font-weight: 600;
}

.processing-workflow-overall {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px 16px;
}

.processing-workflow-overall-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 10.5px;
}

.processing-workflow-overall-head .mono {
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
}

.processing-workflow-progress-stack {
  display: flex;
  align-items: stretch;
  width: 100%;
  height: 14px;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: var(--surface-3);
}

.processing-workflow-progress-segment {
  display: block;
  height: 100%;
  min-width: 2px;
  cursor: help;
  transition: width 0.35s ease, opacity 0.16s ease;
}

.processing-workflow-progress-segment + .processing-workflow-progress-segment {
  box-shadow: inset 1px 0 0 var(--surface);
}

.processing-workflow-progress-empty {
  display: flex;
  align-items: center;
  padding: 0 10px;
  color: var(--faint);
  font-size: 9px;
}

.processing-workflow-progress-legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 5px 14px;
}

.processing-workflow-progress-legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: var(--muted);
  font-size: 9.5px;
  cursor: help;
  transition: opacity 0.16s ease;
}

.processing-workflow-progress-legend-item.is-skipped {
  opacity: 0.55;
}

.processing-workflow-progress-legend-label {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.processing-workflow-progress-legend-item .mono {
  margin-left: auto;
}

.processing-workflow-progress-hint {
  color: var(--faint);
  font-size: 9px;
}

.processing-workflow-scope-note {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin: 0;
  padding: 10px 16px 14px;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.55;
}

.processing-workflow-scope-note svg {
  flex: none;
  margin-top: 1px;
  color: var(--info);
}

.processing-stage-tooltip {
  position: fixed;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm, 6px);
  background: var(--surface);
  box-shadow: var(--shadow-md, 0 12px 30px -18px rgba(0, 0, 0, 0.45));
  font-size: 10px;
  pointer-events: none;
}

.processing-stage-tooltip[hidden] {
  display: none;
}

.processing-stage-tooltip-head {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.processing-stage-tooltip-head strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.processing-stage-tooltip-head .badge {
  margin-left: auto;
}

.processing-stage-tooltip-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  color: var(--muted);
  font-size: 9.5px;
}

.processing-stage-tooltip-meta strong {
  color: var(--ink);
  font-family: var(--font-mono);
}

.processing-stage-tooltip-counts {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9.5px;
}

.processing-stage-tooltip-message {
  max-height: 4.5em;
  overflow: hidden;
  color: var(--faint);
  font-size: 9.5px;
  line-height: 1.45;
}

.parquet-help-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 16px 16px;
}

.parquet-help-lead {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.parquet-help-grid {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 7px 12px;
  font-size: 9.5px;
}

.parquet-help-grid > span {
  color: var(--faint);
  font-family: var(--font-mono);
}

.parquet-help-grid > strong {
  min-width: 0;
  color: var(--ink);
  font-weight: 500;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.parquet-help-grid code,
.parquet-help-lead code {
  padding: 1px 4px;
  border-radius: var(--radius-xs);
  background: var(--surface-3);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 9px;
}

.parquet-help-note {
  margin: 0;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.55;
}

@media (max-width: 640px) {
  .parquet-help-grid {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .parquet-help-grid > span {
    margin-top: 5px;
  }
}

.index-selected-host {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin: 12px 16px 0;
  padding: 9px 11px;
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-sm, 6px);
  background: var(--accent-soft);
  color: var(--muted);
  font-size: 10px;
}

.index-selected-host strong {
  color: var(--ink);
  font-size: 11px;
}

.index-host-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 12px 16px;
}

.index-host-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm, 6px);
  background: var(--surface-2, transparent);
}

.index-host-row.is-selected {
  border-color: var(--success);
  box-shadow: 0 0 0 1px var(--success);
}

.index-host-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.index-host-head strong {
  color: var(--ink);
  font-size: 11px;
}

.index-host-model {
  margin-left: auto;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9.5px;
}

.index-host-url {
  color: var(--ink);
  font-size: 9.5px;
  overflow-wrap: anywhere;
}

.index-host-models {
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.index-host-detail {
  color: var(--faint);
  font-size: 9px;
}

.index-runtime-foot {
  padding: 0 16px 14px;
  color: var(--faint);
  font-size: 9px;
}

.index-runtime-error {
  margin: 12px 16px 0;
}

.index-runtime-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 14px;
  padding: 12px 16px 8px;
  color: var(--muted);
  font-size: 9.5px;
}

.index-runtime-summary code {
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 9.5px;
}

.index-current-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 9px;
  margin: 0 16px 10px;
  padding: 8px 10px;
  border: 1px solid var(--info);
  border-radius: var(--radius-sm, 6px);
  background: var(--info-soft, var(--surface-2));
  color: var(--muted);
  font-size: 9.5px;
}

.index-current-copy {
  flex: 1 1 180px;
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.processing-current-processing {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  padding-left: 9px;
  border-left: 1px solid var(--info);
}

.index-files-card .judgment-months,
.import-files-card .judgment-months,
.court-check-card .judgment-months,
.law-version-card .judgment-months {
  padding: 0 16px 12px;
}

.index-months-table .index-month,
.import-months-table .import-month,
.court-check-months-table .court-check-month,
.law-version-months-table .law-version-month {
  min-width: 30px;
}

.court-check-card .judgment-months .index-runtime-summary,
.law-version-card .judgment-months .index-runtime-summary {
  padding: 0 0 8px;
}

.court-check-card .judgment-months .index-runtime-foot,
.law-version-card .judgment-months .index-runtime-foot {
  padding: 0;
  margin-top: 4px;
}

.law-version-month.is-current {
  outline: 1px solid var(--accent);
  outline-offset: 1px;
}

.law-version-check-status {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 10px;
  line-height: 1.5;
}

.law-version-check-status .badge {
  flex: none;
}

.law-version-check-status.is-ok {
  background: var(--success-soft);
  color: var(--success);
}

.law-version-check-status.is-warn {
  background: var(--warning-soft);
  color: var(--warning);
}

.law-version-check-status.is-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.law-backfill-needed {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm, 6px);
  background: var(--surface-2, transparent);
  color: var(--muted);
  font-size: 9.5px;
}

.law-backfill-needed.is-clear {
  color: var(--faint);
}

.law-backfill-needed-head {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 10px;
}

.law-backfill-needed-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.law-backfill-needed-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 9px;
  min-width: 0;
}

.law-backfill-needed-row > strong {
  color: var(--ink);
  font-size: 10px;
}

.law-backfill-needed-reason {
  flex: 1 1 180px;
  min-width: 0;
  overflow: hidden;
  color: var(--faint);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.law-backfill-needed-more {
  margin-top: 6px;
  color: var(--faint);
  font-size: 9px;
}

.index-storage-grid {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 7px 12px;
  padding: 12px 16px;
  font-size: 9.5px;
}

.index-storage-grid > span {
  color: var(--faint);
  font-family: var(--font-mono);
}

.index-storage-grid > strong {
  min-width: 0;
  color: var(--ink);
  font-weight: 500;
  overflow-wrap: anywhere;
}

.index-storage-path {
  color: var(--muted) !important;
  font-size: 9px;
}

@media (max-width: 640px) {
  .index-storage-grid {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .index-storage-grid > span {
    margin-top: 5px;
  }

  .index-host-model {
    margin-left: 0;
  }
}

.judgment-months {
  padding: 12px;
}

.judgment-months-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 20px 12px;
  color: var(--faint);
  font-size: 10.5px;
}

.judgment-months-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  color: var(--faint);
  font-size: 10px;
}

.judgment-backfill {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  color: var(--faint);
  font-size: 10px;
}

.judgment-backfill [hidden] {
  display: none;
}

.judgment-months-scroll {
  overflow-x: auto;
  padding-bottom: 4px;
}

.judgment-months-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 3px;
  font-size: 10px;
}

.judgment-months-table th {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  text-align: center;
}

.judgment-months-table thead th {
  padding: 2px 4px;
}

.judgment-months-table tbody th {
  padding-right: 8px;
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
}

.judgment-month {
  position: relative;
  min-width: 26px;
  padding: 6px 3px;
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
  text-align: center;
  font-family: var(--font-mono);
  font-size: 9.5px;
  line-height: 1;
  overflow: hidden;
}

.judgment-month-download {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: inherit;
  background: inherit;
  color: inherit;
  text-decoration: none;
  opacity: 0;
  transition: opacity 0.14s ease;
}

.judgment-month:hover .judgment-month-download,
.judgment-month:focus-within .judgment-month-download {
  opacity: 1;
}

.judgment-month-download:hover {
  color: var(--ink);
  text-decoration: none;
}

.judgment-month-download svg {
  width: 11px;
  height: 11px;
}

@media (hover: none) {
  .judgment-month-download {
    opacity: 1;
  }
}

.judgment-month.is-green {
  border-color: var(--success);
  background: var(--success-soft);
  color: var(--success);
}

.judgment-month.is-gray {
  border-color: var(--line-strong);
  background: var(--surface-3);
  color: var(--muted);
}

.judgment-month.is-red {
  border-color: var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
}

.judgment-month.is-empty {
  color: var(--faint);
  opacity: 0.35;
}

.judgment-month.is-active {
  z-index: 1;
  border-color: var(--accent);
  outline: 2px solid var(--info);
  outline-offset: 1px;
  animation: judgment-month-pulse 1.6s ease-in-out infinite;
}

@keyframes judgment-month-pulse {
  0%,
  100% {
    box-shadow:
      0 0 0 2px var(--accent-border),
      0 0 6px var(--accent-soft);
  }
  50% {
    box-shadow:
      0 0 0 3px var(--accent-border),
      0 0 14px var(--accent-soft);
  }
}

.judgment-months-hint {
  margin: 10px 0 0;
  color: var(--faint);
  font-size: 9.5px;
  line-height: 1.55;
}

.processing-timeline-overview {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 18px 0;
}

.processing-timeline-card {
  overflow: hidden;
}

.processing-months-table {
  min-width: 680px;
  table-layout: fixed;
}

.processing-months-table th:first-child {
  width: 46px;
}

.processing-months-table .processing-month:not(.index-month) {
  padding: 3px 2px;
  border-color: transparent;
  background: transparent;
  vertical-align: middle;
}

.processing-month.index-month {
  vertical-align: middle;
}

.processing-month.index-month.is-neutral {
  border-color: var(--line);
  background: var(--surface-2);
  color: var(--muted);
}

.processing-month-number {
  display: block;
  margin-bottom: 2px;
  color: var(--faint);
  font-size: 7.5px;
  line-height: 1;
  text-align: center;
}

.processing-month-stages {
  display: flex;
  height: 12px;
  gap: 1px;
  overflow: hidden;
  border-radius: 3px;
}

.processing-month-stage {
  flex: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 1px;
  background: var(--surface-3);
  color: inherit;
  font: inherit;
  appearance: none;
}

.processing-month-stage.is-actionable {
  cursor: pointer;
}

.processing-month-stage.is-actionable:hover,
.processing-month-stage.is-actionable:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 1px;
}

.processing-month:not(.index-month) .processing-month-stage.is-green,
.processing-timeline-swatch.is-green {
  background: var(--success);
}

.processing-month:not(.index-month) .processing-month-stage.is-red,
.processing-timeline-swatch.is-red {
  background: var(--danger);
}

.processing-month:not(.index-month) .processing-month-stage.is-gray,
.processing-timeline-swatch.is-gray {
  background: var(--line-strong);
}

.processing-month:not(.index-month) .processing-month-stage.is-empty {
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--line);
  opacity: 0.4;
}

.processing-timeline-swatch.is-empty {
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--line);
  opacity: 0.5;
}

.processing-month.is-current {
  outline: 1px solid var(--accent);
  outline-offset: 1px;
}

.processing-month.is-current .processing-month-number {
  color: var(--accent);
  font-weight: 700;
}

/* Index-style processing cells use the same active treatment as the index
   file timeline, while keeping the cell's overall status background. */
.processing-month.index-month.is-current {
  z-index: 1;
  border-color: var(--accent);
  outline: 2px solid var(--info);
  outline-offset: 1px;
  animation: judgment-month-pulse 1.6s ease-in-out infinite;
}

.processing-month.index-month.is-current .index-month-number {
  color: var(--accent);
  font-weight: 700;
}

@media (prefers-reduced-motion: reduce) {
  .processing-month.index-month.is-current {
    animation: none;
  }
}

.processing-month.is-processing-current:not(.is-current) {
  outline: 2px dashed var(--info);
  outline-offset: -3px;
}

.processing-month.is-processing-current:not(.is-current)
  .processing-month-number {
  color: var(--info);
  font-weight: 700;
}

.processing-month:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
}

.processing-timeline-swatch {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 2px;
}

.processing-timeline-legend-label {
  color: var(--muted);
  font-weight: 600;
}

.processing-timeline-legend + .processing-timeline-legend {
  margin-top: -2px;
}

.processing-workflow-command-grid {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 9px 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  font-size: 10.5px;
}

.processing-workflow-command-grid > span {
  color: var(--faint);
  font-family: var(--font-mono);
}

.processing-workflow-command-grid > code {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 10px;
}

.processing-workflow-command {
  white-space: pre-wrap;
}

.processing-ollama-block {
  margin: 14px 16px 0;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}

.processing-ollama-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.processing-ollama-head .side-card-title {
  margin-right: auto;
}

.processing-ollama-subtitle,
.processing-ollama-hint {
  color: var(--faint);
  font-size: 9.5px;
  line-height: 1.55;
}

.processing-ollama-hint {
  margin-top: 8px;
}

.processing-ollama-loading,
.processing-ollama-empty {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 10.5px;
}

.processing-ollama-empty {
  display: block;
}

.processing-ollama-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 9px 0;
  color: var(--muted);
  font-size: 9.5px;
}

.processing-ollama-summary strong {
  color: var(--ink);
}

.processing-ollama-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.processing-ollama-host {
  display: grid;
  grid-template-columns: 18px 22px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  cursor: grab;
}

.processing-ollama-host.is-online {
  border-left-color: var(--success);
  background: var(--success-soft);
}

.processing-ollama-host.is-offline {
  border-left-color: var(--line-strong);
  background: var(--surface-2);
  color: var(--muted);
}

.processing-ollama-host.is-dragging {
  cursor: grabbing;
  opacity: 0.6;
}

.processing-ollama-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 1px;
  color: var(--faint);
  cursor: grab;
  touch-action: none;
}

html.processing-ollama-dragging,
html.processing-ollama-dragging body {
  cursor: grabbing;
  user-select: none;
}

.processing-ollama-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
}

.processing-ollama-host.is-online .processing-ollama-rank {
  background: var(--success-soft);
  color: var(--success);
}

.processing-ollama-main {
  min-width: 0;
}

.processing-ollama-title {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  min-width: 0;
}

.processing-ollama-title strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.processing-ollama-status {
  color: var(--faint);
  font-size: 9px;
  font-weight: 650;
}

.processing-ollama-host.is-online .processing-ollama-status {
  color: var(--success);
}

.processing-ollama-url {
  display: block;
  overflow: hidden;
  color: var(--faint);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.processing-ollama-models {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}

.processing-ollama-model,
.processing-ollama-role {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 1px 6px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 8.5px;
  line-height: 1.55;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.processing-ollama-model.is-online,
.processing-ollama-role.is-online {
  background: var(--success-soft);
  color: var(--success);
}

.processing-ollama-model.is-offline,
.processing-ollama-role.is-offline {
  background: var(--surface-3);
  color: var(--faint);
}

.processing-ollama-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}

.processing-ollama-detail {
  color: var(--faint);
  font-size: 9px;
  line-height: 1.55;
}

.processing-ollama-order {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.processing-ollama-order .btn {
  min-width: 26px;
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.4;
}

.processing-workflow-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 16px 0;
}

.processing-download-progress {
  display: grid;
  flex-basis: 100%;
  gap: 7px;
  margin-top: 2px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.processing-download-progress[hidden] {
  display: none;
}

.processing-download-progress-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 10.5px;
}

.processing-download-progress-month {
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
}

.processing-download-progress-file {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 9.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.processing-download-progress-track {
  position: relative;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-3);
}

.processing-download-progress-track > span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--info));
  transition: width 0.35s ease;
}

.processing-download-progress.is-indeterminate
  .processing-download-progress-track
  > span {
  width: 34%;
  animation: processing-download-progress-slide 1.15s ease-in-out infinite;
}

@keyframes processing-download-progress-slide {
  0% {
    transform: translateX(-110%);
  }
  100% {
    transform: translateX(330%);
  }
}

.processing-download-progress-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9.5px;
}

.processing-workflow-run {
  padding: 16px;
}

.processing-workflow-run-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.processing-workflow-run-grid {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 6px 12px;
  margin-top: 12px;
  font-size: 10.5px;
}

.processing-workflow-run-grid > span {
  color: var(--faint);
}

.processing-workflow-run-grid > strong {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-weight: 500;
}

.processing-workflow-empty {
  padding: 16px;
  color: var(--faint);
  font-size: 11px;
}

@media (max-width: 900px) {
  .processing-sidebar {
    top: auto;
  }
}

@media (max-width: 560px) {
  .processing-workflow-command-grid {
    grid-template-columns: 1fr;
  }

  .processing-ollama-host {
    grid-template-columns: 18px minmax(0, 1fr) auto;
  }

  .processing-ollama-rank {
    display: none;
  }
}

/* ----------------------------------------------------- question bank workspace */
.quality-layout {
  align-items: start;
}

.quality-sidebar {
  top: 86px;
}

.quality-panel {
  min-width: 0;
}

.qb-card {
  padding: 16px;
}

.qb-card .side-card-head {
  margin-bottom: 12px;
}

.qb-form,
.qb-suite-form,
.qb-review-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.qb-form-grid,
.qb-score-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.qb-score-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.qb-wide {
  grid-column: 1 / -1;
}

.qb-form .field,
.qb-suite-form .field,
.qb-review-form .field {
  min-width: 0;
}

.qb-form textarea,
.qb-card textarea {
  min-height: 70px;
  resize: vertical;
}

.qb-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.qb-form-hint,
.qb-muted {
  color: var(--faint);
  font-size: 10px;
  line-height: 1.55;
}

.qb-ai-form textarea {
  min-height: 110px;
}

.qb-ai-answer {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.qb-ai-answer > strong {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.5;
}

.qb-ai-meta {
  color: var(--faint);
  font-size: 10px;
}

.qb-ai-warnings {
  padding: 10px;
  border: 1px solid var(--warning);
  border-radius: var(--radius-sm);
  background: var(--warning-soft);
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
}

.qb-ai-warnings strong {
  display: block;
  margin-bottom: 4px;
  color: var(--warning);
}

.qb-ai-warnings ul {
  margin: 0;
  padding-left: 16px;
  list-style: disc;
}

.qb-ai-warnings li {
  margin: 2px 0;
}

.qb-checkbox {
  align-items: center;
}

.qb-filters {
  display: grid;
  grid-template-columns: minmax(180px, 1.6fr) repeat(4, minmax(110px, 1fr)) auto;
  gap: 7px;
  margin-bottom: 12px;
}

.qb-tag-filter {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 34px;
  align-items: center;
  gap: 4px;
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.qb-tag-values {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  flex-wrap: wrap;
  gap: 4px;
}

.qb-tag-placeholder {
  color: var(--faint);
  font-size: 10px;
}

.qb-tag-chip {
  gap: 3px;
  padding: 2px 3px 2px 7px;
  font-size: 9.5px;
}

.qb-tag-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 2px;
  border: 0;
  background: transparent;
  color: var(--faint);
  cursor: pointer;
}

.qb-tag-remove:hover {
  color: var(--danger);
}

.qb-tag-add {
  display: inline-flex;
  width: 22px;
  height: 22px;
  flex: none;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.qb-tag-add:hover,
.qb-tag-add:focus-visible {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  color: var(--accent);
  outline: none;
}

.qb-tag-popover {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 30;
  width: max-content;
  min-width: 240px;
  max-width: 320px;
  padding: 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.qb-tag-popover[hidden] {
  display: none;
}

.qb-tag-popover .input {
  width: 100%;
}

.qb-tag-results {
  display: flex;
  max-height: 240px;
  flex-direction: column;
  gap: 2px;
  margin-top: 6px;
  overflow: auto;
}

.qb-tag-option {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 10.5px;
  text-align: left;
  cursor: pointer;
}

.qb-tag-option:hover,
.qb-tag-option:focus {
  background: var(--accent-soft);
  color: var(--accent);
  outline: none;
}

.qb-tag-option small {
  color: var(--faint);
  font-size: 9px;
}

.qb-tag-loading {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 4px;
  color: var(--faint);
  font-size: 10px;
}

.qb-tag-empty {
  padding: 8px 4px;
  color: var(--faint);
  font-size: 10px;
}

.qb-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.qb-item,
.qb-suite {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.qb-item-head {
  display: flex;
  align-items: flex-start;
  gap: 9px;
}

.qb-id {
  flex: none;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.6;
}

.qb-item-title {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 3px;
}

.qb-item-title strong {
  color: var(--ink);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.qb-meta,
.qb-fingerprint {
  color: var(--faint);
  font-size: 9.5px;
  line-height: 1.5;
}

.qb-fingerprint {
  margin: 5px 0;
  overflow-wrap: anywhere;
}

.qb-stale {
  color: var(--danger);
}

.qb-ready {
  color: var(--ok);
}

.qb-labels {
  margin-top: 7px;
}

.qb-item-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin-top: 9px;
  color: var(--faint);
  font-size: 9.5px;
}

.qb-item-foot .qb-actions {
  margin-left: auto;
}

.qb-comment {
  max-width: 100%;
  overflow-wrap: anywhere;
}

.qb-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
  color: var(--faint);
  font-size: 10px;
}

.qb-empty {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 22px 12px;
  color: var(--faint);
  font-size: 11px;
}

.qb-empty-block {
  align-items: flex-start;
  gap: 10px;
  padding: 18px 14px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.qb-empty-icon {
  display: inline-flex;
  flex: none;
  margin-top: 2px;
  color: var(--faint);
}

.qb-empty-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--muted);
}

.qb-empty-copy strong {
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 600;
}

.qb-empty-copy p {
  margin: 0;
  color: var(--faint);
  font-size: 10px;
  line-height: 1.55;
}

.qb-empty-copy .qb-actions {
  margin-top: 6px;
}

.qb-suite {
  margin-top: 9px;
}

.qb-suite-items {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 9px 0;
}

.qb-check-list {
  display: flex;
  max-height: 280px;
  flex-direction: column;
  gap: 3px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.qb-check-row {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 5px 6px;
  border-radius: var(--radius-xs);
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.45;
}

.qb-check-row:hover {
  background: var(--surface);
}

.qb-check-row input {
  margin-top: 2px;
  flex: none;
}

.qb-check-row strong {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 9.5px;
}

.qb-check-row small {
  color: var(--faint);
}

.qb-review-hint {
  margin: 8px 0 12px;
  color: var(--faint);
  font-size: 10px;
  line-height: 1.55;
}

.qb-review-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.qb-review-tab.is-active {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  color: var(--accent);
}

.qb-review-tab-count {
  display: inline-flex;
  min-width: 16px;
  height: 16px;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--faint);
  font-size: 9px;
  line-height: 1;
}

.qb-review-tab.is-active .qb-review-tab-count {
  background: var(--surface-2);
  color: var(--accent);
}

.qb-review-split {
  display: grid;
  grid-template-columns: minmax(240px, 360px) minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
}

.qb-review-list-pane {
  display: flex;
  min-width: 0;
  max-height: 76vh;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.qb-review-list {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 6px;
  overflow: auto;
}

.qb-review-item {
  display: flex;
  width: 100%;
  flex-direction: column;
  gap: 4px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.qb-review-item:hover {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.qb-review-item.is-active {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  box-shadow: inset 2px 0 0 var(--accent);
}

.qb-review-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.qb-review-item-top .qb-id,
.qb-review-item-top .badge {
  flex: none;
}

.qb-review-item-top .qb-review-item-meta {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qb-review-item strong {
  display: -webkit-box;
  overflow: hidden;
  color: var(--ink);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.qb-review-item-meta {
  color: var(--faint);
  font-size: 9.5px;
  line-height: 1.5;
}

.qb-review-item .qb-stale {
  color: var(--warning);
}

.qb-review-detail-pane {
  min-width: 0;
  max-height: 76vh;
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.qb-review-pane-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.qb-review-pane-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.qb-review-pane-title {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
}

.qb-review-pane-title strong {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.5;
}

.qb-review-pane-side {
  display: flex;
  flex: none;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.qb-review-note {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 10px;
}

.qb-review-note p {
  margin: 4px 0 0;
  color: var(--faint);
  line-height: 1.55;
  white-space: pre-wrap;
}

.qb-review-placeholder {
  justify-content: center;
  min-height: 240px;
  margin: 0;
}

.qb-empty-compact {
  padding: 18px 8px;
}

.qb-review-decisions {
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.qb-reference {
  padding: 10px;
  border-left: 2px solid var(--accent-border);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.qb-reference p {
  margin: 4px 0 0;
  white-space: pre-wrap;
}

.qb-review-history {
  padding: 10px;
  border-top: 1px solid var(--line);
}

.qb-review-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 10px;
}

.qb-review-row p {
  flex-basis: 100%;
  margin: 2px 0 0;
  color: var(--faint);
  line-height: 1.5;
}

.qb-import {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.qb-import summary {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  color: var(--muted);
  font-size: 10.5px;
}

.qb-import textarea {
  margin-top: 8px;
}

/* ---------------------------------------------- benchmark question browser */
.qb-bank-head {
  align-items: flex-start;
  flex-wrap: wrap;
  padding: 0 0 12px;
  border-bottom: 1px solid var(--line);
}

.qb-bank-heading {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.qb-bank-sub {
  color: var(--faint);
  font-size: 9.5px;
  line-height: 1.4;
}

.qb-bank-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.qb-suite-picker {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--faint);
  font-size: 9px;
}

.qb-suite-picker .select {
  width: auto;
  min-width: 150px;
  max-width: 240px;
  padding: 5px 8px;
  font-size: 9.5px;
}

.qb-bank-tabs {
  display: flex;
  width: fit-content;
  max-width: 100%;
  gap: 3px;
  margin-bottom: 12px;
  padding: 3px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.qb-bank-tab {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--faint);
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.qb-bank-tab:hover {
  color: var(--ink);
}

.qb-bank-tab.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-xs);
}

.qb-bank-tab .badge {
  padding: 1px 5px;
  font-size: 8px;
}

.qb-bank-split {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(0, 1.25fr);
  gap: 12px;
  align-items: start;
}

.qb-bank-list {
  display: flex;
  max-height: min(70vh, 720px);
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  padding-right: 2px;
}

.qb-bank-row {
  position: relative;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.qb-bank-row:hover {
  border-color: var(--accent-border);
  background: var(--surface-2);
}

.qb-bank-row.is-active {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  box-shadow: inset 2px 0 0 var(--accent);
}

.qb-bank-select {
  display: flex;
  width: 100%;
  min-width: 0;
  align-items: flex-start;
  gap: 8px;
  padding: 9px 62px 9px 9px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.qb-bank-index {
  flex: none;
  min-width: 20px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 9px;
  line-height: 1.7;
}

.qb-bank-row.is-active .qb-bank-index,
.qb-bank-full-item:hover .qb-bank-index {
  color: var(--accent);
}

.qb-bank-item-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 3px;
}

.qb-bank-item-copy strong {
  color: var(--ink);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.qb-bank-item-copy small {
  color: var(--faint);
  font-size: 9px;
  line-height: 1.4;
}

.qb-bank-actions {
  position: absolute;
  top: 5px;
  right: 5px;
  display: flex;
  gap: 2px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
}

.qb-bank-row:hover .qb-bank-actions,
.qb-bank-row:focus-within .qb-bank-actions,
.qb-bank-full-item:hover .qb-bank-actions,
.qb-bank-full-item:focus-within .qb-bank-actions {
  opacity: 1;
  visibility: visible;
}

.qb-bank-icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: var(--surface);
  color: var(--faint);
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    color 0.15s ease;
}

.qb-bank-icon:hover {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  color: var(--accent);
}

.qb-bank-icon.is-danger:hover {
  border-color: var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
}

.qb-bank-answer-pane {
  min-width: 0;
  max-height: min(70vh, 720px);
  overflow-y: auto;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.qb-bank-answer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.qb-bank-answer-heading {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
}

.qb-bank-answer-kicker {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--accent);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.qb-bank-answer-question {
  color: var(--ink);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.qb-bank-answer-state {
  flex: none;
  color: var(--faint);
  font-size: 9px;
  line-height: 1.5;
  text-align: right;
}

.qb-bank-answer-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  color: var(--faint);
  font-size: 9px;
  line-height: 1.5;
}

.qb-bank-answer-block {
  margin-top: 12px;
  padding-top: 11px;
  border-top: 1px dashed var(--line);
}

.qb-bank-section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--faint);
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.qb-bank-answer-text {
  margin: 6px 0 0;
  color: var(--ink);
  font-size: 11.5px;
  line-height: 1.75;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.qb-bank-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}

.qb-bank-law {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: var(--surface);
  color: var(--ink);
  font-size: 9.5px;
  line-height: 1.4;
  text-decoration: none;
}

a.qb-bank-law:hover {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.qb-bank-law strong {
  font-weight: 600;
}

.qb-bank-law small {
  color: var(--faint);
  font-size: 8.5px;
}

.qb-bank-citations .chip {
  font-size: 8px;
}

.qb-bank-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

.qb-bank-stat {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: var(--surface);
  color: var(--faint);
  font-size: 8.5px;
}

.qb-bank-stat strong {
  color: var(--ink);
  font-size: 9.5px;
}

.qb-bank-empty {
  display: flex;
  min-height: 230px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 24px 16px;
  color: var(--faint);
  font-size: 10.5px;
  line-height: 1.6;
  text-align: center;
}

.qb-bank-empty-icon {
  display: grid;
  width: 42px;
  height: 42px;
  margin-bottom: 3px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--faint);
}

.qb-bank-empty strong {
  color: var(--ink);
  font-size: 12px;
}

.qb-bank-loading {
  display: flex;
  min-height: 300px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--faint);
  font-size: 11px;
}

.qb-bank-full {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.qb-bank-full-item {
  position: relative;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color 0.15s ease;
}

.qb-bank-full-item:hover {
  border-color: var(--accent-border);
}

.qb-bank-full-head {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 0 62px 10px 0;
  border-bottom: 1px solid var(--line);
}

.qb-bank-full-title {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: 3px;
}

.qb-bank-full-title strong {
  color: var(--ink);
  font-size: 11.5px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.qb-bank-full-title small {
  color: var(--faint);
  font-size: 9px;
  line-height: 1.4;
}

.qb-bank-full-head .qb-bank-actions {
  top: 0;
  right: 0;
}

.qb-bank-full-item .qb-bank-empty {
  min-height: 110px;
}

.qb-suite-manage {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.qb-suite-manage summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.qb-suite-manage summary::-webkit-details-marker {
  display: none;
}

.qb-suite-manage summary::before {
  content: "▸";
  color: var(--faint);
  font-size: 9px;
}

.qb-suite-manage[open] summary::before {
  content: "▾";
}

.qb-suite-manage summary .qb-muted {
  margin-left: 4px;
  font-weight: 400;
}

.qb-suite-manage-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 12px;
}

.qb-suite-manage-body .qb-suite-form {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

@media (hover: none) {
  .qb-bank-actions {
    opacity: 1;
    visibility: visible;
  }
}

@media (max-width: 1020px) {
  .qb-bank-split {
    grid-template-columns: minmax(0, 1fr);
  }

  .qb-bank-list {
    max-height: 42vh;
  }

  .qb-bank-answer-pane {
    max-height: none;
  }
}

@media (max-width: 560px) {
  .qb-bank-head {
    align-items: stretch;
  }

  .qb-bank-controls {
    width: 100%;
  }

  .qb-suite-picker {
    width: 100%;
  }

  .qb-suite-picker .select {
    max-width: none;
    flex: 1;
  }

  .qb-bank-tabs {
    width: 100%;
  }

  .qb-bank-tab {
    flex: 1;
    justify-content: center;
  }
}

@media (max-width: 1020px) {
  .qb-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .qb-form-grid,
  .qb-score-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .qb-review-split {
    grid-template-columns: minmax(0, 1fr);
  }

  .qb-review-list-pane {
    max-height: 42vh;
  }

  .qb-review-detail-pane {
    max-height: none;
  }
}

@media (max-width: 560px) {
  .quality-sidebar {
    top: auto;
  }

  .qb-form-grid,
  .qb-score-grid,
  .qb-filters {
    grid-template-columns: minmax(0, 1fr);
  }

  .qb-item-foot .qb-actions {
    margin-left: 0;
  }

  .qb-review-pane-head {
    flex-direction: column;
  }

  .qb-review-pane-side {
    width: 100%;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

@media (max-width: 560px) {
  .qb-tag-popover {
    left: 0;
    right: 0;
    width: auto;
    min-width: 0;
    max-width: none;
  }
}

/* ------------------------------------------------------- benchmark reports */
.performance-layout {
  align-items: start;
}

.performance-sidebar {
  top: 86px;
}

.performance-panel {
  min-width: 0;
}

.performance-data-layout {
  grid-template-columns: 280px minmax(0, 1fr);
}

.bench-card,
.bench-detail {
  padding: 16px;
}

.bench-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.bench-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

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

.bench-check {
  align-self: end;
  min-height: 34px;
}

.bench-progress {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--muted);
  font-size: 10px;
}

.bench-progress-head,
.bench-progress-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
}

.bench-progress-head strong {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.bench-progress-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font-weight: 600;
}

.bench-progress-state .spinner {
  width: 11px;
  height: 11px;
  border-width: 1.5px;
}

.bench-progress-eta {
  color: var(--accent);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.bench-progress .processing-bar {
  width: 100%;
  flex: none;
  margin: 0;
}

.bench-progress-bar.is-waiting::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -30%;
  width: 30%;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.4;
  animation: bench-progress-waiting 1.5s ease-in-out infinite;
}

@keyframes bench-progress-waiting {
  0% {
    left: -30%;
  }
  100% {
    left: 100%;
  }
}

.bench-progress .processing-bar-fill {
  background: var(--accent);
  transition: width 1s linear;
}

.bench-progress-foot {
  color: var(--faint);
  font-size: 9.5px;
}

.bench-progress-foot [data-bench-slot="progress-elapsed"] {
  color: var(--muted);
}

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

.bench-metric {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.bench-metric strong {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 18px;
}

.bench-metric small {
  display: block;
  margin-top: 2px;
  color: var(--faint);
  font-size: 9px;
}

.bench-runs-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

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

.bench-run {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted);
  text-align: left;
  cursor: pointer;
}

.bench-run:hover,
.bench-run.is-active {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.bench-run-head,
.bench-run-meta,
.bench-run-scores {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 10px;
}

.bench-run-head strong {
  color: var(--ink);
  font-size: 11.5px;
}

.bench-run-meta,
.bench-run-scores {
  color: var(--faint);
  font-size: 9.5px;
}

.bench-run-scores span {
  color: var(--muted);
}

.bench-run-config {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 12px;
  margin: 8px 0 12px;
  color: var(--faint);
  font-size: 9.5px;
}

.bench-cases {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.bench-case {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.bench-case > summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
}

.bench-case > summary::-webkit-details-marker {
  display: none;
}

.bench-case-question {
  min-width: 0;
  flex: 1;
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 600;
}

.bench-case-time,
.bench-case-score {
  color: var(--faint);
  font-size: 9.5px;
}

.bench-case-body {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 0 12px 12px;
}

.bench-case-meta,
.bench-case-stages,
.bench-case-metrics {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 10px;
  color: var(--faint);
  font-size: 9.5px;
}

.bench-case-stages .chip,
.bench-case-metrics span {
  font-size: 9px;
}

.bench-answer,
.bench-judge {
  padding: 9px;
  border-left: 2px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.6;
}

.bench-judge {
  border-left-color: var(--accent-border);
}

.bench-answer p,
.bench-judge p {
  margin: 4px 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.bench-judge span {
  color: var(--faint);
  font-size: 9.5px;
}

.bench-human-form {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 9px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
}

.bench-human-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.bench-history {
  padding: 9px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 9.5px;
}

.bench-history-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 10px;
  margin-top: 5px;
  color: var(--faint);
}

@media (max-width: 1020px) {
  .performance-data-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .bench-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bench-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .performance-sidebar {
    top: auto;
  }

  .bench-form-grid,
  .bench-human-grid,
  .bench-metrics {
    grid-template-columns: minmax(0, 1fr);
  }
}

.bench-stage-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin: 2px 0 4px;
}

.bench-stage {
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: var(--surface-2);
}

.bench-stage span,
.bench-stage small {
  display: block;
  color: var(--faint);
  font-size: 8.5px;
  overflow-wrap: anywhere;
}

.bench-stage strong {
  display: block;
  margin: 2px 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
}

@media (max-width: 900px) {
  .bench-stage-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .bench-stage-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ----------------------------------------------------- appearance modes */
:root[data-appearance="dark"] {
  color-scheme: dark;
  --bg: #0b0f14;
  --bg-soft: #10151b;
  --surface: #141a21;
  --surface-2: #1a222b;
  --surface-3: #232d38;
  --ink: #eef3f8;
  --muted: #a7b3c0;
  --faint: #7d8896;
  --line: #2a3541;
  --line-strong: #3b4957;
  --header-bg: rgba(11, 15, 20, 0.92);
  --header-ink: #f3f7fb;
  --header-muted: #a0acb9;
  --header-line: #2a3541;
  --header-shadow: 0 1px 0 rgba(255, 255, 255, 0.04);
  --code-bg: #0c1116;
  --code-ink: #d8e2ee;
  --chip-bg: #1b232c;
  --table-stripe: rgba(255, 255, 255, 0.025);
  --action-bg: var(--accent);
  --action-bg-hover: var(--accent-hover);
  --action-ink: var(--accent-ink, #ffffff);
  --page-backdrop: radial-gradient(
    900px 460px at 82% -12%,
    var(--accent-soft),
    transparent 60%
  );
  --hero-bg: linear-gradient(
    180deg,
    rgba(20, 26, 33, 0.85),
    rgba(11, 15, 20, 0)
  );
  --selection: color-mix(in srgb, var(--accent) 35%, transparent);
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.42);
  --shadow-md: 0 12px 30px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.65);
}

/* ------------------------------------------------ processing waterfall */
.processing-wf-overview {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin: 18px 0;
}

.processing-wf-section {
  --section-accent: var(--accent);
  position: relative;
  overflow: hidden;
}

.processing-wf-section::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: linear-gradient(
    90deg,
    var(--section-accent) 0%,
    color-mix(in srgb, var(--section-accent) 35%, transparent) 48%,
    transparent 100%
  );
  pointer-events: none;
}

.processing-wf-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 12px;
}

.processing-wf-section-title {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}

.processing-wf-section-title > div {
  min-width: 0;
}

.processing-wf-section-icon {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid color-mix(in srgb, var(--section-accent) 42%, var(--line));
  border-radius: 9px;
  background: color-mix(in srgb, var(--section-accent) 13%, var(--surface));
  color: var(--section-accent);
}

.processing-wf-section-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.processing-wf-section-count {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--muted);
  font: inherit;
  font-size: 9.5px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease,
    transform 0.16s ease;
}

.processing-wf-section-count:hover {
  border-color: color-mix(in srgb, var(--section-accent) 48%, var(--line));
  transform: translateY(-1px);
}

.processing-wf-section-count strong {
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
}

.processing-wf-section-count.is-update {
  border-color: color-mix(in srgb, var(--warning) 45%, var(--line));
  background: var(--warning-soft);
  color: var(--warning);
}

.processing-wf-section-count.is-update strong {
  color: var(--warning);
}

.processing-wf-section-count.is-pending {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
  background: var(--accent-soft);
  color: var(--muted);
}

.processing-wf-body {
  padding: 0 14px 14px;
}

.processing-embedding-strip.rag-model-strip {
  margin: 10px 0 0;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
}

.processing-workflow-panel .processing-embedding-strip.rag-model-strip {
  margin: 12px 16px 0;
}

.processing-embedding-strip .rag-model-strip-head {
  margin-bottom: 7px;
}

.processing-embedding-strip .rag-model-buttons {
  gap: 5px;
}

.processing-embedding-strip .rag-model-button {
  padding: 5px 9px;
  font-size: 9px;
}

.processing-embedding-strip .rag-model-hint {
  margin-top: 6px;
}

.processing-wf-versions {
  margin: 0 0 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-2);
}

.processing-wf-versions-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 9px;
  font-weight: 650;
}

.processing-wf-versions-title .mono {
  color: var(--faint);
  font-size: 8px;
  font-weight: 500;
}

.processing-wf-versions-scroll {
  overflow-x: auto;
}

.processing-wf-version-grid {
  display: grid;
  grid-template-columns: 54px 110px 122px 116px minmax(130px, 1fr);
  gap: 8px;
  align-items: center;
  min-width: 560px;
  padding: 6px 10px;
}

.processing-wf-version-head {
  border-bottom: 1px dashed var(--line);
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.processing-wf-version-row {
  color: var(--muted);
  font-size: 9px;
}

.processing-wf-version-row + .processing-wf-version-row {
  border-top: 1px dashed var(--line);
}

.processing-wf-version-row strong {
  color: var(--ink);
  font-size: 9.5px;
}

.processing-wf-version-row code {
  color: var(--section-accent);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.processing-wf-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  padding: 2px 2px 12px;
  color: var(--faint);
  font-size: 9px;
}

.processing-wf-legend-item,
.processing-wf-source {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.processing-wf-legend-item svg {
  color: var(--faint);
}

.processing-wf-source {
  padding: 2px 7px;
  border: 1px solid color-mix(in srgb, var(--source-accent) 38%, var(--line));
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--source-accent) 9%, var(--surface));
  color: var(--muted);
  font-weight: 600;
}

.processing-wf-source i,
.processing-wf-lane-label i,
.processing-wf-fact-label i {
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 50%;
  background: var(--source-accent, var(--lane-accent, var(--section-accent)));
  box-shadow: 0 0 0 2px
    color-mix(
      in srgb,
      var(--source-accent, var(--lane-accent, var(--section-accent))) 16%,
      transparent
    );
}

.processing-wf-legend-hint {
  margin-left: auto;
  color: var(--faint);
  font-size: 8.5px;
}

.processing-wf-stages {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.processing-wf-stage {
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  transition: border-color 0.18s ease, box-shadow 0.18s ease,
    transform 0.18s ease;
}

.processing-wf-stage:hover {
  border-color: color-mix(in srgb, var(--section-accent) 42%, var(--line));
}

.processing-wf-stage[open] {
  border-color: color-mix(in srgb, var(--section-accent) 52%, var(--line));
  box-shadow: 0 12px 28px -24px
    color-mix(in srgb, var(--section-accent) 70%, transparent);
}

.processing-wf-stage.is-danger {
  border-color: color-mix(in srgb, var(--danger) 48%, var(--line));
}

.processing-wf-stage > summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  align-items: start;
  column-gap: 12px;
  list-style: none;
  cursor: pointer;
  padding: 10px 11px 9px;
}

.processing-wf-stage > summary::-webkit-details-marker {
  display: none;
}

.processing-wf-stage > summary:focus-visible {
  outline: none;
  box-shadow: var(--focus);
  border-radius: 10px;
}

.processing-wf-summary-main {
  display: flex;
  grid-column: 1;
  grid-row: 1;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.processing-wf-step {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 700;
}

.processing-wf-stage-icon {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 27px;
  height: 27px;
  border: 1px solid
    color-mix(in srgb, var(--stage-color) 40%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--stage-color) 10%, var(--surface));
  color: var(--stage-color);
}

.processing-wf-stage-copy {
  display: flex;
  min-width: 0;
  flex: 1 1 150px;
  flex-direction: column;
  gap: 1px;
}

.processing-wf-stage-copy strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.processing-wf-stage-copy small {
  overflow: hidden;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.processing-wf-stage-copy .processing-wf-stage-model {
  color: color-mix(in srgb, var(--section-accent) 58%, var(--faint));
  font-size: 7.5px;
}

.processing-wf-stage-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.processing-wf-count {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  min-height: 20px;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 8.5px;
  font-weight: 500;
  white-space: nowrap;
}

.processing-wf-count strong {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
}

.processing-wf-count.is-update {
  border-color: color-mix(in srgb, var(--warning) 42%, var(--line));
  background: var(--warning-soft);
  color: var(--warning);
}

.processing-wf-count.is-pending {
  border-color: color-mix(in srgb, var(--accent) 34%, var(--line));
  background: var(--accent-soft);
  color: var(--muted);
}

.processing-wf-stage-percent {
  flex: none;
  min-width: 40px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 650;
  text-align: right;
}

.processing-wf-stage-source {
  flex: 0 1 430px;
  min-width: 0;
  overflow: hidden;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 8px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.processing-wf-chevron {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  color: var(--faint);
  transition: transform 0.18s ease, color 0.18s ease;
}

.processing-wf-stage[open] .processing-wf-chevron {
  color: var(--section-accent);
  transform: rotate(180deg);
}

.processing-wf-lanes {
  display: flex;
  grid-column: 1;
  grid-row: 2;
  flex-direction: column;
  gap: 5px;
  margin-top: 8px;
  padding-left: 31px;
}

.processing-wf-rail {
  display: flex;
  grid-column: 2;
  grid-row: 1 / span 2;
  min-width: 154px;
  flex-direction: column;
  align-self: stretch;
  justify-content: space-between;
  gap: 8px;
  padding-left: 12px;
  border-left: 1px dashed var(--line);
}

.processing-wf-rail-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
}

.processing-wf-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 25px;
  height: 25px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--muted);
  transition: border-color 0.16s ease, background 0.16s ease,
    color 0.16s ease;
}

.processing-wf-icon-btn.is-label {
  width: auto;
  gap: 4px;
  padding: 0 7px;
  font-family: var(--font-mono);
  font-size: 8.5px;
}

.processing-wf-icon-btn:hover {
  border-color: color-mix(in srgb, var(--section-accent) 48%, var(--line));
  background: var(--surface);
  color: var(--section-accent);
}

.processing-wf-rail-actions {
  display: flex;
  width: 100%;
  max-width: 190px;
  flex-direction: column;
  align-items: stretch;
  gap: 5px;
}

.processing-wf-rail-actions .btn {
  justify-content: center;
  min-height: 28px;
  padding: 4px 8px;
  font-size: 10px;
}

.processing-wf-rail-actions .btn-primary:disabled {
  background: var(--surface-3);
  color: var(--faint);
  box-shadow: none;
  opacity: 0.75;
}

.processing-wf-cancel:not(:disabled) {
  border-color: color-mix(in srgb, var(--danger) 45%, var(--line));
  color: var(--danger);
}

.processing-wf-cancel:not(:disabled):hover {
  border-color: var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
}

.processing-wf-lane {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.processing-wf-lane.is-running {
  border-color: var(--lane-accent);
  box-shadow: 0 0 0 1px var(--lane-accent);
}

.processing-wf-lane-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.processing-wf-lane-swatch {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 3px;
  background: var(--lane-accent);
}

.processing-wf-lane-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 11px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.processing-wf-lane-label small {
  margin-left: 2px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 7.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.processing-wf-lane-percent {
  margin-left: auto;
  color: var(--lane-accent);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
}

.processing-wf-lane-percent.is-completed {
  color: var(--faint);
}

.processing-wf-lane-bar {
  display: block;
  height: 7px;
}

.processing-wf-lane.is-completed .processing-wf-lane-bar {
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
}

.processing-wf-lane-idle {
  display: flex;
  align-items: center;
  min-width: 0;
  min-height: 17px;
  padding: 0 1px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 8.5px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.processing-wf-lane-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  min-width: 0;
  color: var(--faint);
  font-size: 9px;
  line-height: 1.35;
}

.processing-wf-lane-count {
  color: var(--muted);
}

.processing-wf-lane-message {
  flex: 1 1 180px;
  min-width: 0;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.processing-wf-stage-percent.is-completed {
  color: var(--faint);
}

.processing-wf-lane.is-completed .processing-wf-lane-label small {
  color: var(--faint);
}

.processing-wf-details {
  padding: 0 11px 12px;
}

.processing-wf-work-group,
.processing-wf-facts {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

.processing-wf-work-head {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 7px;
}

.processing-wf-work-kicker {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: 0.02em;
}

.processing-wf-work-head .badge {
  margin-left: auto;
}

.processing-wf-work-list {
  display: flex;
  max-height: 260px;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  padding-right: 3px;
}

.processing-wf-work-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm, 6px);
  background: var(--surface-2);
}

.processing-wf-work-item.is-warn {
  border-left: 3px solid var(--warning);
}

.processing-wf-work-item.is-danger {
  border-left: 3px solid var(--danger);
}

.processing-wf-work-item.is-ok {
  border-left: 3px solid var(--success);
}

.processing-wf-work-icon {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--muted);
}

.processing-wf-work-item.is-warn .processing-wf-work-icon {
  border-color: color-mix(in srgb, var(--warning) 40%, var(--line));
  background: var(--warning-soft);
  color: var(--warning);
}

.processing-wf-work-item.is-danger .processing-wf-work-icon {
  border-color: color-mix(in srgb, var(--danger) 40%, var(--line));
  background: var(--danger-soft);
  color: var(--danger);
}

.processing-wf-work-item.is-ok .processing-wf-work-icon {
  border-color: color-mix(in srgb, var(--success) 40%, var(--line));
  background: var(--success-soft);
  color: var(--success);
}

.processing-wf-work-copy {
  min-width: 0;
  flex: 1;
}

.processing-wf-work-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
}

.processing-wf-work-title strong {
  color: var(--ink);
  font-size: 10.5px;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.processing-wf-work-count {
  padding: 1px 5px;
  border-radius: var(--radius-pill);
  background: var(--surface-3);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8px;
}

.processing-wf-work-copy p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.processing-wf-work-copy small {
  display: block;
  margin-top: 2px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 8px;
}

.processing-wf-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 8px;
}

.processing-wf-fact {
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm, 6px);
  background: var(--surface-2);
}

.processing-wf-fact-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.processing-wf-fact-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--ink);
  font-size: 9.5px;
  font-weight: 650;
}

.processing-wf-fact-head .badge {
  margin-left: auto;
}

.processing-wf-fact-value {
  flex: 0 0 100%;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8.5px;
}

.processing-wf-fact-message {
  margin-top: 5px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.processing-wf-fact-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 4px 8px;
  margin-top: 6px;
}

.processing-wf-fact-stats > span {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs, 4px);
  background: var(--surface);
}

.processing-wf-fact-stats span span {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.processing-wf-fact-stats strong {
  overflow: hidden;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.processing-wf-note {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-top: 9px;
  padding: 7px 8px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm, 6px);
  color: var(--faint);
  font-size: 8.5px;
  line-height: 1.5;
}

.processing-wf-note svg {
  flex: none;
  margin-top: 1px;
  color: var(--info);
}

.processing-wf-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.processing-stage-tooltip-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.processing-stage-tooltip-badges .processing-wf-count {
  font-size: 8px;
}

@media (max-width: 900px) {
  .processing-wf-section-head {
    flex-direction: column;
  }

  .processing-wf-section-actions {
    width: 100%;
  }

  .processing-wf-legend-hint {
    flex: 1 0 100%;
    margin-left: 0;
  }

  .processing-wf-stage > summary {
    grid-template-columns: minmax(0, 1fr);
  }

  .processing-wf-summary-main {
    flex-wrap: wrap;
  }

  .processing-wf-stage-source {
    flex: 1 0 100%;
    max-width: none;
    white-space: normal;
    text-align: right;
  }

  .processing-wf-rail {
    grid-column: 1;
    grid-row: 3;
    min-width: 0;
    flex-direction: row;
    align-items: center;
    padding-top: 8px;
    padding-left: 0;
    border-top: 1px dashed var(--line);
    border-left: 0;
  }

  .processing-wf-rail-top {
    justify-content: flex-start;
  }

  .processing-wf-rail-actions {
    width: auto;
    max-width: none;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-end;
  }
}

@media (max-width: 640px) {
  .processing-wf-section-head {
    padding: 14px 12px 10px;
  }

  .processing-wf-body {
    padding: 0 10px 12px;
  }

  .processing-wf-summary-main {
    display: grid;
    grid-template-columns: 22px 27px minmax(0, 1fr) auto;
    align-items: center;
    gap: 6px;
  }

  .processing-wf-step {
    grid-column: 1;
    grid-row: 1;
  }

  .processing-wf-stage-icon {
    grid-column: 2;
    grid-row: 1;
  }

  .processing-wf-stage-copy {
    grid-column: 3;
    grid-row: 1;
  }

  .processing-wf-stage-percent {
    grid-column: 4;
    grid-row: 2;
    margin-left: 0;
  }

  .processing-wf-stage-source {
    grid-column: 3 / span 2;
    grid-row: 3;
    max-width: none;
    white-space: normal;
    text-align: right;
  }

  .processing-wf-chevron {
    grid-column: 4;
    grid-row: 1;
  }

  .processing-wf-lanes {
    padding-left: 0;
  }

  .processing-wf-facts {
    grid-template-columns: minmax(0, 1fr);
  }

  .processing-wf-rail {
    flex-direction: column;
    align-items: stretch;
  }

  .processing-wf-rail-top {
    justify-content: flex-end;
  }

  .processing-wf-rail-actions {
    justify-content: flex-end;
  }
}

/* Index build workflow waterfall */
.index-wf-card {
  overflow: visible;
}

.index-wf-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 14px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 9.5px;
}

.index-wf-summary strong {
  color: var(--ink);
  font-weight: 600;
}

.index-wf-chart {
  border-bottom: 1px solid var(--line);
}

.index-wf-step {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 8.5px;
}

/* The six index stages reuse the RAG pipeline waterfall structure so the
   axis, stage rows, bars, expanded details and hover tooltip stay identical. */
.index-wf-stage .index-wf-step {
  margin-right: 4px;
}

/* The unprocessed tail of a running or partial stage stays hollow so only the
   completed portion is colored, matching the waterfall's progress semantics. */
.index-wf-bar.is-hollow {
  border: 1px solid var(--bar-color, var(--stage-color));
  background: transparent;
  box-sizing: border-box;
}

.index-wf-stage.is-pending .rag-wf-track,
.index-wf-stage.is-skipped .rag-wf-track {
  opacity: 0.55;
}

.index-wf-overall {
  padding: 12px 16px 14px;
}

.index-wf-overall-head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 10px;
}

.index-wf-overall-track {
  height: 8px;
  overflow: hidden;
  border-radius: 4px;
  background: var(--surface-3);
}

.index-wf-overall-track > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--info));
}

@media (max-width: 640px) {
  .index-wf-summary {
    padding: 10px 12px;
  }
}

/* Non-index workflow waterfall.  Reuses the canonical .rag-wf-* structure so
   the axis, sequential bars, hollow progress, details and tooltips stay
   identical to the RAG and index pipelines. */
.workflow-wf-card {
  overflow: visible;
}

.workflow-wf-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 14px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 9.5px;
}

.workflow-wf-summary strong {
  color: var(--ink);
  font-weight: 600;
}

.workflow-wf-chart {
  border-bottom: 1px solid var(--line);
}

.workflow-wf-chart .rag-wf-axis {
  padding: 12px 16px 2px;
}

.workflow-wf-chart .rag-wf-legend {
  padding: 4px 16px 7px;
}

.workflow-wf-chart .rag-wf-stages {
  padding: 0 16px 12px;
}

.workflow-wf-chart .rag-wf-hint {
  padding: 0 16px 14px;
}

.workflow-wf-step {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 8.5px;
}

.workflow-wf-stage .workflow-wf-step {
  margin-right: 4px;
}

/* The unprocessed tail of a running or partial stage stays hollow so only the
   completed portion is colored. */
.workflow-wf-bar.is-hollow {
  border: 1px solid var(--bar-color, var(--stage-color));
  background: transparent;
  box-sizing: border-box;
}

.workflow-wf-stage.is-pending .rag-wf-track,
.workflow-wf-stage.is-skipped .rag-wf-track,
.workflow-wf-stage.is-idle .rag-wf-track {
  opacity: 0.55;
}

.workflow-wf-stage.is-error .rag-wf-stage-meta {
  color: var(--danger);
}

.workflow-wf-legend i.is-solid-state {
  background: var(--ink);
}

.workflow-wf-legend i.is-hollow-state {
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--ink);
}

.workflow-wf-legend i.is-progress-state {
  background: linear-gradient(
    to top,
    var(--ink) 50%,
    transparent 50%
  );
  box-shadow: inset 0 0 0 1px var(--ink);
}

.workflow-wf-legend i.is-empty-state {
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--line);
  opacity: 0.5;
}

.workflow-wf-overall {
  padding: 12px 16px 14px;
}

.workflow-wf-overall-head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 10px;
}

.workflow-wf-overall-track {
  height: 8px;
  overflow: hidden;
  border-radius: 4px;
  background: var(--surface-3);
}

.workflow-wf-overall-track > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--info));
}

@media (max-width: 640px) {
  .workflow-wf-summary {
    padding: 10px 12px;
  }

  .workflow-wf-chart .rag-wf-axis,
  .workflow-wf-chart .rag-wf-legend,
  .workflow-wf-chart .rag-wf-stages,
  .workflow-wf-chart .rag-wf-hint {
    padding-left: 12px;
    padding-right: 12px;
  }

  .workflow-wf-overall {
    padding: 12px 12px 14px;
  }

  .workflow-wf-card .rag-wf-stage-head {
    flex-wrap: wrap;
  }

  .workflow-wf-card .rag-wf-stage-meta {
    justify-content: flex-start;
    white-space: normal;
  }
}

/* Index month A/R/E blocks.  The active month is marked with border/outline
   only; its padding stays clean so progress is shown only inside the blocks. */
.index-months-table .index-month-are {
  min-width: 36px;
  padding: 3px 2px;
}

.index-month-are.is-active {
  background-color: transparent;
  background-image: none;
  box-shadow: none;
  animation: none;
}

.index-month-number {
  display: block;
  margin-bottom: 2px;
  color: var(--faint);
  font-size: 7.5px;
  line-height: 1;
  text-align: center;
}

.index-month-blocks {
  display: flex;
  height: 12px;
  gap: 1px;
  overflow: hidden;
  border-radius: 3px;
}

.index-month-block {
  flex: 1;
  min-width: 0;
  border-radius: 1px;
  background: linear-gradient(
    to top,
    var(--block-color, var(--line-strong)) var(--fill, 0%),
    var(--surface-3) var(--fill, 0%)
  );
}

.index-month-block.is-active {
  --block-color: var(--success);
}

.index-month-block.is-reuse {
  --block-color: var(--info);
}

.index-month-block.is-embed {
  --block-color: #a78bfa;
}

.index-month-block.is-incomplete {
  background: linear-gradient(
    to top,
    var(--block-color, var(--line-strong)) var(--fill, 0%),
    var(--bg) var(--fill, 0%)
  );
  box-shadow: inset 0 0 0 1px var(--block-color, var(--line-strong));
}

/* Processing overview timelines reuse the index month-cell geometry. Each
   stage keeps its own colour; completed stages are solid, unfinished stages
   are hollow, and a running stage shows a vertical progress fill. */
.processing-month-stage.is-download {
  --block-color: #22c55e;
}

.processing-month-stage.is-prepared {
  --block-color: #ec4899;
}

.processing-month-stage.is-indexed {
  --block-color: #3b82f6;
}

.processing-month-stage.is-parquet {
  --block-color: #ec4899;
}

.processing-month-stage.is-extract {
  --block-color: #f59e0b;
}

.processing-month-stage.is-raw_parquet {
  --block-color: #ec4899;
}

.processing-month-stage.is-filter {
  --block-color: #a78bfa;
}

.processing-month-stage.is-postgres {
  --block-color: #3b82f6;
}

.processing-month-stage.is-qdrant {
  --block-color: #f59e0b;
}

.processing-month.index-month .processing-month-stage.is-complete {
  background: var(--block-color);
  box-shadow: none;
}

.processing-month.index-month .processing-month-stage.is-incomplete {
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--block-color);
}

.processing-month.index-month .processing-month-stage.is-running {
  background: linear-gradient(
    to top,
    color-mix(in srgb, var(--block-color) 42%, var(--surface-2))
      var(--stage-progress, 0%),
    color-mix(in srgb, var(--block-color) 14%, transparent)
      var(--stage-progress, 0%)
  );
  box-shadow: inset 0 0 0 1px var(--block-color);
}

.processing-month.index-month .processing-month-stage.is-partial {
  background: color-mix(in srgb, var(--block-color) 42%, var(--surface-2));
  box-shadow: inset 0 0 0 1px var(--block-color);
}

.processing-month.index-month .processing-month-stage.is-empty {
  --block-color: var(--line);
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--line);
  opacity: 0.4;
}

.index-month-are-key {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: 0 0 8px;
  color: var(--faint);
  font-size: 9px;
  line-height: 1.4;
}

.index-month-are-key span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.index-month-are-key i {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--surface-3);
}

.index-month-are-key i.is-active {
  background: var(--success);
}

.index-month-are-key i.is-reuse {
  background: var(--info);
}

.index-month-are-key i.is-embed {
  background: #a78bfa;
}

.index-month-are-key i.is-empty {
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

.index-month-are-key i.is-outline {
  background: var(--bg);
  box-shadow: inset 0 0 0 1px var(--faint);
}

.index-month-are-key i.is-current {
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--accent);
  outline: 1px solid var(--info);
  outline-offset: 0;
}

/* Processing timeline legend reuses the index key layout with stage colours
   and neutral solid/hollow/progress state swatches. */
.processing-timeline-legend .processing-timeline-swatch.is-download {
  background: #22c55e;
}

.processing-timeline-legend .processing-timeline-swatch.is-prepared {
  background: #ec4899;
}

.processing-timeline-legend .processing-timeline-swatch.is-indexed {
  background: #3b82f6;
}

.processing-timeline-legend .processing-timeline-swatch.is-parquet {
  background: #ec4899;
}

.processing-timeline-legend .processing-timeline-swatch.is-extract {
  background: #f59e0b;
}

.processing-timeline-legend .processing-timeline-swatch.is-raw-parquet {
  background: #ec4899;
}

.processing-timeline-legend .processing-timeline-swatch.is-filter {
  background: #a78bfa;
}

.processing-timeline-legend .processing-timeline-swatch.is-postgres {
  background: #3b82f6;
}

.processing-timeline-legend .processing-timeline-swatch.is-qdrant {
  background: #f59e0b;
}

.processing-timeline-legend .processing-timeline-swatch.is-solid-state {
  background: var(--ink);
}

.processing-timeline-legend .processing-timeline-swatch.is-hollow-state {
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--ink);
}

.processing-timeline-legend .processing-timeline-swatch.is-progress-state {
  background: linear-gradient(
    to top,
    var(--ink) 50%,
    transparent 50%
  );
  box-shadow: inset 0 0 0 1px var(--ink);
}

.processing-timeline-legend .processing-timeline-swatch.is-partial-state {
  background: color-mix(in srgb, #f59e0b 42%, var(--surface-2));
  box-shadow: inset 0 0 0 1px #f59e0b;
}

.processing-timeline-legend .processing-timeline-swatch.is-empty {
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--line);
  opacity: 0.5;
}

/* Law / order index version timelines */
.law-index-timelines {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.law-index-timelines .law-index-timeline-card {
  margin-bottom: 0;
}

/* Index runtime metrics: months, rows, rate and timings share one 2x3 grid */
.index-runtime-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin-left: auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.index-runtime-metric {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
  padding: 5px 10px;
  background: var(--surface-2);
  white-space: nowrap;
}

.index-runtime-metric > span {
  color: var(--muted);
  font-size: 9.5px;
}

.index-runtime-metric strong {
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

/* Keep the metrics inside the timeline header.  The title takes the free
   space so the grid stays right aligned until the header wraps. */
.index-runtime-head {
  flex-wrap: wrap;
  align-items: flex-start;
}

.index-runtime-head .side-card-title {
  margin-right: auto;
}

@media (max-width: 560px) {
  .index-runtime-head {
    align-items: stretch;
  }

  .index-runtime-head .side-card-title {
    width: 100%;
  }

  .index-runtime-metrics {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .index-runtime-metric {
    padding: 5px 8px;
  }
}

/* Data versions tab.  Uses the same hero, metric cards and current-row
   language as the service overview and processing timelines. */
.data-version-hero {
  flex-wrap: wrap;
  align-items: center;
}

.data-version-hero .status-hero-main {
  flex: 1 1 520px;
}

.data-version-ring {
  --ring-color: var(--accent);
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: 132px;
  height: 132px;
  margin-left: auto;
  border-radius: 50%;
  background: conic-gradient(
    var(--ring-color) var(--coverage, 0%),
    var(--surface-3) 0
  );
}

.data-version-ring.is-warn {
  --ring-color: var(--warning);
}

.data-version-ring::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: var(--surface);
}

.data-version-ring-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-align: center;
}

.data-version-ring-inner strong {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: var(--display-weight);
  letter-spacing: var(--display-tracking);
  line-height: 1;
}

.data-version-ring-inner span {
  color: var(--muted);
  font-size: 9px;
}

.data-version-ring-inner small {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 8px;
}

.data-version-metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.data-version-grid {
  align-items: start;
}

.data-version-card.is-wide-grid {
  grid-column: 1 / -1;
}

.data-version-card {
  overflow: hidden;
}

.data-version-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  padding: 0 16px 14px;
}

.data-version-fact {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm, 6px);
  background: var(--surface-2);
}

.data-version-fact.is-wide {
  grid-column: 1 / -1;
}

.data-version-fact > span {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 8.5px;
}

.data-version-fact > strong {
  min-width: 0;
  color: var(--ink);
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.data-version-fact > strong.mono {
  font-family: var(--font-mono);
  font-size: 10px;
}

.data-version-coverage {
  padding: 0 16px 12px;
}

.data-version-coverage-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 9.5px;
}

.data-version-coverage-head strong {
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 11px;
}

.data-version-coverage-track {
  height: 8px;
  margin-top: 6px;
  overflow: hidden;
  border-radius: 4px;
  background: var(--surface-3);
}

.data-version-coverage-track > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--info));
}

.data-version-coverage.is-warn .data-version-coverage-track > span {
  background: linear-gradient(90deg, var(--warning), var(--danger));
}

.data-version-coverage-foot {
  margin-top: 5px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 8.5px;
}

.data-version-note {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: 0 16px 14px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm, 6px);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.55;
}

.data-version-note.is-warn {
  border-color: var(--warning);
  background: var(--warning-soft);
  color: var(--warning);
}

.data-version-note svg {
  flex: none;
  margin-top: 1px;
}

@media (max-width: 900px) {
  .data-version-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .data-version-hero .status-hero-main {
    flex-basis: 100%;
  }

  .data-version-ring {
    width: 108px;
    height: 108px;
    margin-left: 0;
    align-self: flex-end;
  }

  .data-version-ring-inner strong {
    font-size: 20px;
  }

  .data-version-facts {
    grid-template-columns: 1fr;
  }

  .data-version-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* API endpoint catalog. */
.api-endpoint-hero {
  flex-wrap: wrap;
  align-items: center;
}

.api-endpoint-hero .status-hero-main {
  flex: 1 1 520px;
}

.api-endpoint-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  flex: none;
}

.api-endpoint-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
  align-items: start;
}

.api-endpoint-group {
  overflow: hidden;
}

.api-endpoint-group .endpoint-row {
  grid-template-columns: 46px minmax(0, 1fr) minmax(0, 0.9fr);
  padding: 7px 14px;
}

.api-endpoint-group .endpoint-path {
  font-size: 9.5px;
}

.api-endpoint-group .endpoint-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

.endpoint-method.is-get {
  background: var(--success-soft);
  color: var(--success);
}

.endpoint-method.is-post {
  background: var(--accent-soft);
  color: var(--accent);
}

.endpoint-method.is-patch,
.endpoint-method.is-put {
  background: var(--warning-soft);
  color: var(--warning);
}

.endpoint-method.is-delete {
  background: var(--danger-soft);
  color: var(--danger);
}

.endpoint-row.is-deprecated {
  opacity: 0.55;
}

.endpoint-row.is-deprecated .endpoint-path {
  text-decoration: line-through;
}

@media (max-width: 900px) {
  .api-endpoint-groups {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .api-endpoint-hero .status-hero-main {
    flex-basis: 100%;
  }

  .api-endpoint-actions {
    width: 100%;
  }

  .api-endpoint-group .endpoint-row {
    grid-template-columns: 46px minmax(0, 1fr);
  }
}
