/* Aquistra Workspace — design tokens from Materials/Aquistra Workspace */

:root {
  --hx-bg: oklch(0.97 0.005 230);
  --hx-fg: oklch(0.27 0.03 245);
  --hx-muted: oklch(0.55 0.02 240);
  --hx-border: oklch(0.89 0.01 235);
  --hx-border-soft: oklch(0.94 0.005 235);
  --hx-card: #fff;
  --hx-header: oklch(0.24 0.035 245);
  --hx-accent: oklch(0.50 0.10 240);
  --hx-accent-hover: oklch(0.44 0.10 240);
  --hx-accent-soft: oklch(0.93 0.03 240);
  --hx-accent-fg: oklch(0.42 0.10 240);
  --hx-ok: oklch(0.42 0.10 160);
  --hx-ok-soft: oklch(0.93 0.05 160);
  --hx-ok-fg: oklch(0.38 0.10 160);
  --hx-warn: oklch(0.55 0.10 65);
  --hx-warn-soft: oklch(0.98 0.01 65);
  --hx-warn-border: oklch(0.90 0.04 65);
  --hx-fail: oklch(0.50 0.15 25);
  --hx-fail-soft: oklch(0.94 0.03 25);
  --hx-mono: "IBM Plex Mono", ui-monospace, monospace;
  --hx-sans: "Instrument Sans", system-ui, sans-serif;
}

html, body {
  margin: 0;
  font-family: var(--hx-sans);
  background: var(--hx-bg);
  color: var(--hx-fg);
}

a { color: var(--hx-accent); text-decoration: none; }
a:hover { color: oklch(0.38 0.10 240); text-decoration: underline; }
* { box-sizing: border-box; }

/* —— Shell —— */
.hx-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.hx-header {
  background: var(--hx-header);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 88px 0 20px; /* room for fixed Sign in (MainLayout) */
  height: 52px;
  flex: 0 0 auto;
  min-width: 0;
}

.hx-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
}
.hx-brand:hover { color: #fff; text-decoration: none; }

.hx-logo {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  display: block;
  object-fit: contain;
}
/* legacy bars (if any remain) */
.hx-logo span {
  display: none;
}

.hx-brand-name {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.02em;
}

.hx-project-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 13px;
  cursor: pointer;
  color: #fff;
  appearance: none;
  font-family: var(--hx-sans);
}
.hx-project-pill:hover { background: rgba(255, 255, 255, 0.14); }
.hx-project-pill .label { opacity: 0.6; }
.hx-project-pill .name { font-weight: 600; }
.hx-project-pill .caret { opacity: 0.6; font-size: 10px; }

.hx-header-spacer { flex: 1; min-width: 8px; }

.hx-header-status {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 1 auto;
  min-width: 0;
  max-width: min(420px, 46vw);
}

.hx-api-status {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  opacity: 0.85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.hx-api-status.down {
  opacity: 1;
  color: oklch(0.80 0.12 60);
}
.hx-api-status.warming {
  opacity: 1;
  color: oklch(0.82 0.10 75);
}
.hx-api-status.auth {
  opacity: 1;
  color: oklch(0.85 0.10 55);
}
.hx-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex: 0 0 auto;
}
.hx-dot.ok { background: oklch(0.72 0.14 160); }
.hx-dot.warn { background: oklch(0.70 0.16 60); }
.hx-dot.muted { background: oklch(0.70 0.02 240); }

/* Live activity — pulse only the active badge / phase dot */
@keyframes hx-pulse-opacity {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}
@keyframes hx-pulse-scale {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 transparent; }
  50% { transform: scale(1.15); box-shadow: 0 0 0 3px oklch(0.70 0.10 240 / 0.25); }
}
@keyframes hx-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@keyframes hx-indeterminate {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}
.hx-chip.hx-live {
  animation: hx-pulse-opacity 1.5s ease-in-out infinite;
}
.hx-dot-pulse {
  animation: hx-pulse-scale 1.4s ease-in-out infinite;
}
.hx-phase-row.active .name { color: var(--hx-accent-fg); font-weight: 650; }
.hx-phase-row.hx-shimmer-row .time {
  min-width: 52px;
  height: 1em;
  border-radius: 3px;
  color: transparent;
  background: linear-gradient(
    90deg,
    oklch(0.92 0.01 240) 0%,
    oklch(0.86 0.03 240) 40%,
    oklch(0.92 0.01 240) 80%
  );
  background-size: 200% 100%;
  animation: hx-shimmer 1.4s linear infinite;
}
.hx-progress.hx-progress-indeterminate > i {
  width: 32% !important;
  animation: hx-indeterminate 1.3s ease-in-out infinite;
}
.hx-progress.overrun > i {
  background: oklch(0.62 0.12 65);
}
.hx-elapsed-block {
  margin-bottom: 10px;
}
.hx-elapsed-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  font-size: 11.5px;
  margin-bottom: 5px;
  flex-wrap: wrap;
}
.hx-overrun {
  color: oklch(0.48 0.12 55);
  font-weight: 650;
}

.hx-env-badge {
  font-size: 11px;
  font-family: var(--hx-mono);
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  padding: 3px 8px;
  opacity: 0.8;
  white-space: nowrap;
  flex: 0 0 auto;
}

/* Stack status under brand row on narrow widths so chips don't collide with Sign in */
@media (max-width: 720px) {
  .hx-header {
    flex-wrap: wrap;
    height: auto;
    min-height: 52px;
    padding: 8px 16px 8px 16px;
    row-gap: 8px;
  }
  .hx-header-spacer { display: none; }
  .hx-header-status {
    width: 100%;
    max-width: none;
    order: 10;
    padding-right: 72px;
  }
}

/* —— Tabs —— */
.hx-tabs {
  background: #fff;
  border-bottom: 1px solid var(--hx-border);
  display: flex;
  gap: 2px;
  padding: 0 20px;
  flex: 0 0 auto;
}

.hx-tab {
  appearance: none;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: oklch(0.52 0.02 240);
  font-family: var(--hx-sans);
  font-size: 13.5px;
  font-weight: 500;
  padding: 12px 14px 10px;
  cursor: pointer;
}
.hx-tab:hover { color: oklch(0.30 0.05 240); }
.hx-tab.active {
  border-bottom-color: var(--hx-accent);
  color: var(--hx-fg);
  font-weight: 650;
}

/* —— Main —— */
.hx-main {
  flex: 1;
  padding: 24px 24px 48px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}

/* —— Cards & type —— */
.hx-card {
  background: var(--hx-card);
  border: 1px solid var(--hx-border);
  border-radius: 10px;
  padding: 18px 20px;
}

.hx-section-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--hx-muted);
  margin-bottom: 10px;
}

.hx-mono { font-family: var(--hx-mono); }
.hx-muted { color: var(--hx-muted); }
.hx-title { font-size: 14px; font-weight: 700; }

/* —— Chips —— */
.hx-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
}
.hx-chip.lg { padding: 3px 9px; font-size: 11.5px; }
.hx-chip.complete,
.hx-chip.ok { background: var(--hx-ok-soft); color: var(--hx-ok-fg); }
.hx-chip.running,
.hx-chip.pending,
.hx-chip.queued { background: var(--hx-accent-soft); color: var(--hx-accent-fg); }
.hx-chip.failed,
.hx-chip.err { background: var(--hx-fail-soft); color: var(--hx-fail); }
.hx-chip.warning,
.hx-chip.warn { background: var(--hx-warn-soft); color: var(--hx-warn); border: 1px solid var(--hx-warn-border); }
.hx-chip.secondary { background: oklch(0.94 0.01 240); color: oklch(0.45 0.02 240); }
/* Post-complete warning (exit 139 after genuineSolve) — amber note, not red failed */
.hx-warn-note {
  font-size: 12px;
  color: var(--hx-warn);
  font-weight: 550;
  line-height: 1.4;
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--hx-warn-soft);
  border: 1px solid var(--hx-warn-border);
}
/* Honesty label for generated / sample surfaces — always visible, never swapped for "complete" */
.hx-chip.illustrative {
  background: oklch(0.95 0.03 85);
  color: oklch(0.40 0.06 70);
  border: 1px solid oklch(0.88 0.04 80);
}
.hx-illust-note {
  font-size: 11.5px;
  color: oklch(0.48 0.04 70);
  font-weight: 500;
  line-height: 1.35;
}

/* Honesty vocabulary key — definitions from actual chip behaviour */
.hx-honesty-key {
  margin: 0 0 10px;
  border: 1px solid oklch(0.90 0.02 240);
  border-radius: 10px;
  background: oklch(0.99 0.005 240);
  padding: 0 12px;
}
.hx-honesty-key > summary {
  cursor: pointer;
  list-style: none;
  font-size: 12px;
  font-weight: 600;
  color: oklch(0.38 0.03 240);
  padding: 10px 0;
  user-select: none;
}
.hx-honesty-key > summary::-webkit-details-marker { display: none; }
.hx-honesty-key > summary::before {
  content: "▸ ";
  color: oklch(0.55 0.04 240);
  font-weight: 700;
}
.hx-honesty-key[open] > summary::before { content: "▾ "; }
.hx-honesty-key-body {
  padding: 0 0 12px;
  border-top: 1px solid oklch(0.93 0.01 240);
}
.hx-honesty-lead,
.hx-honesty-foot {
  font-size: 12px;
  color: var(--hx-muted);
  line-height: 1.45;
  margin: 10px 0 8px;
}
.hx-honesty-foot { margin-top: 4px; }
.hx-honesty-dl {
  display: grid;
  grid-template-columns: minmax(120px, max-content) 1fr;
  gap: 8px 12px;
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
}
.hx-honesty-dl dt {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}
.hx-honesty-dl dd {
  margin: 0;
  color: oklch(0.35 0.02 240);
}
.hx-muted-inline {
  font-size: 11px;
  font-weight: 500;
  color: var(--hx-muted);
}
.hx-section-label-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.hx-section-label-row .hx-section-label { margin-bottom: 0; }

/* —— Buttons —— */
.hx-btn {
  appearance: none;
  border: none;
  border-radius: 7px;
  padding: 8px 16px;
  font-family: var(--hx-sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.hx-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.hx-btn-primary {
  background: var(--hx-accent);
  color: #fff;
}
.hx-btn-primary:hover:not(:disabled) { background: var(--hx-accent-hover); }
.hx-btn-ghost {
  background: #fff;
  color: var(--hx-fail);
  border: 1px solid oklch(0.88 0.05 25);
  padding: 4px 12px;
  font-size: 12px;
  border-radius: 6px;
}
.hx-btn-ghost:hover:not(:disabled) { background: oklch(0.96 0.02 25); }
.hx-btn-accept {
  background: var(--hx-ok-soft);
  color: oklch(0.35 0.10 160);
  border: 1px solid oklch(0.85 0.06 160);
  padding: 4px 12px;
  font-size: 12px;
  border-radius: 6px;
}
.hx-btn-accept:hover:not(:disabled) { background: oklch(0.88 0.07 160); }
.hx-btn-outline {
  background: transparent;
  color: var(--hx-muted);
  border: 1px solid var(--hx-border);
  padding: 6px 12px;
  font-size: 12.5px;
}
.hx-btn-outline:hover:not(:disabled) { border-color: var(--hx-accent); color: var(--hx-fg); }

/* —— Overview grid —— */
.hx-overview-top {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.hx-overview-bottom {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
}

.hx-seed-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 2px;
}
.hx-seed-ver {
  font-family: var(--hx-mono);
  font-weight: 500;
  font-size: 14px;
  color: var(--hx-accent);
}
.hx-seed-meta {
  font-size: 12.5px;
  color: var(--hx-muted);
  margin-bottom: 14px;
}
.hx-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px 16px;
  font-size: 12.5px;
}
.hx-meta-grid .k { color: var(--hx-muted); }
.hx-meta-grid .v { font-family: var(--hx-mono); font-weight: 500; }

.hx-progress {
  height: 6px;
  border-radius: 3px;
  background: oklch(0.93 0.008 235);
  overflow: hidden;
}
.hx-progress > i {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--hx-accent);
}
.hx-progress.ok > i { background: oklch(0.50 0.11 160); }

.hx-gate-value {
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.hx-gate-value .n {
  font-family: var(--hx-mono);
  font-size: 26px;
  font-weight: 600;
}

.hx-source-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--hx-border-soft);
  font-size: 13px;
}
.hx-source-row:last-child { border-bottom: none; }
.hx-source-row .name { font-weight: 600; width: 150px; flex: 0 0 150px; }
.hx-source-row .role { color: var(--hx-muted); flex: 1; }
.hx-source-row .fresh {
  font-family: var(--hx-mono);
  font-size: 11.5px;
  color: var(--hx-muted);
}

/* —— KB Sources page (S1) —— */
.hx-kb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.hx-kb-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--hx-muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--hx-border);
  background: oklch(0.98 0.005 240);
  white-space: nowrap;
}
.hx-kb-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--hx-border-soft);
  vertical-align: top;
}
.hx-kb-table tbody tr {
  cursor: pointer;
}
.hx-kb-table tbody tr:hover {
  background: oklch(0.98 0.01 240);
}
.hx-kb-table tbody tr.selected {
  background: var(--hx-accent-soft);
}
.hx-kb-table tbody tr.disabled-row {
  opacity: 0.72;
}

/* Sources table: cells stay inside their columns at ~1080p (clamp + tooltip; full text in drawer). */
.hx-kb-table.hx-kb-table-clamp {
  table-layout: fixed;
  width: 100%;
}
.hx-kb-table.hx-kb-table-clamp th,
.hx-kb-table.hx-kb-table-clamp td {
  overflow: hidden;
  min-width: 0;
}
.hx-kb-table-clamp .hx-col-source { width: 15%; }
.hx-kb-table-clamp .hx-col-kind { width: 8%; }
.hx-kb-table-clamp .hx-col-feeds { width: 14%; }
.hx-kb-table-clamp .hx-col-extent { width: 8%; }
.hx-kb-table-clamp .hx-col-fresh { width: 13%; }
.hx-kb-table-clamp .hx-col-license { width: 15%; }
.hx-kb-table-clamp .hx-col-schedule { width: 8%; }
.hx-kb-table-clamp .hx-col-action { width: 19%; }
.hx-source-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
}
.hx-source-browse {
  font-size: 12px;
  font-weight: 600;
}
.hx-cell-clamp {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
  min-width: 0;
}
.hx-chip.hx-chip-disabled {
  opacity: 0.78;
  cursor: help;
  border: 1px dashed oklch(0.86 0.015 240);
}
.hx-source-drawer-text {
  font-size: 13px;
  margin: 8px 0 12px;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.hx-btn {
  appearance: none;
  font-family: var(--hx-sans);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: var(--hx-accent);
  color: #fff;
  cursor: pointer;
}
.hx-btn:hover:not(:disabled) {
  background: var(--hx-accent-hover);
}
.hx-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.hx-btn.secondary {
  background: oklch(0.96 0.01 240);
  color: var(--hx-fg);
  border-color: var(--hx-border);
}
.hx-btn.secondary:hover:not(:disabled) {
  background: oklch(0.93 0.015 240);
}

.hx-review-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.hx-review-btn {
  appearance: none;
  text-align: left;
  background: oklch(0.97 0.01 240);
  border: 1px solid oklch(0.90 0.02 240);
  border-radius: 8px;
  padding: 12px 14px;
  cursor: pointer;
  font-family: var(--hx-sans);
  width: 100%;
  color: inherit;
}
.hx-review-btn:hover { border-color: oklch(0.60 0.08 240); }
.hx-review-btn .t { font-size: 13.5px; font-weight: 600; }
.hx-review-btn .d { font-size: 12px; color: var(--hx-muted); margin-top: 2px; }
.hx-review-static {
  background: oklch(0.97 0.01 240);
  border: 1px dashed oklch(0.88 0.02 240);
  border-radius: 8px;
  padding: 12px 14px;
}
.hx-review-static .t { font-size: 13.5px; font-weight: 600; color: var(--hx-muted); }
.hx-review-static .d { font-size: 12px; color: var(--hx-muted); margin-top: 2px; }

/* —— Runs —— */
.hx-runs-layout {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.hx-runs-list {
  flex: 1;
  min-width: 0;
  background: #fff;
  border: 1px solid var(--hx-border);
  border-radius: 10px;
  overflow: hidden;
}
.hx-runs-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid oklch(0.92 0.008 235);
}
.hx-runs-cols,
.hx-run-row {
  display: grid;
  grid-template-columns: 90px 1fr 110px 90px 80px;
  gap: 0 12px;
  align-items: center;
  padding: 11px 18px;
  font-size: 13px;
}
.hx-runs-cols {
  padding: 8px 18px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--hx-muted);
  border-bottom: 1px solid oklch(0.92 0.008 235);
}
.hx-run-row {
  border-bottom: 1px solid var(--hx-border-soft);
  cursor: pointer;
  background: #fff;
}
.hx-run-row:hover { background: oklch(0.965 0.008 240); }
.hx-run-row.selected { background: oklch(0.965 0.012 240); }
.hx-run-row .status-note {
  display: flex;
  align-items: center;
  gap: 8px;
}
.hx-run-row .note { font-size: 12px; color: var(--hx-muted); }

.hx-run-detail {
  width: 360px;
  flex: 0 0 360px;
}
.hx-phase-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  font-size: 12.5px;
  border-bottom: 1px solid var(--hx-border-soft);
}
.hx-phase-row .name { flex: 1; font-weight: 500; }
.hx-phase-row .time {
  font-family: var(--hx-mono);
  font-size: 11.5px;
  color: var(--hx-muted);
}
.hx-artifact-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  margin-bottom: 6px;
}
.hx-artifact-row .fn {
  font-family: var(--hx-mono);
  color: var(--hx-accent);
}
.hx-artifact-row .sz {
  font-family: var(--hx-mono);
  font-size: 11px;
  color: var(--hx-muted);
  margin-left: auto;
}
.hx-detail-box {
  font-size: 12px;
  color: var(--hx-muted);
  background: oklch(0.97 0.005 235);
  border-radius: 7px;
  padding: 10px 12px;
  margin-top: 4px;
}

/* —— Diagnostics —— */
.hx-diag-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.hx-stats {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.hx-stat-card {
  background: #fff;
  border: 1px solid var(--hx-border);
  border-radius: 10px;
  padding: 14px 16px;
}
.hx-stat-card .label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--hx-muted);
  margin-bottom: 6px;
}
.hx-stat-card .val {
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.hx-stat-card .val .n {
  font-family: var(--hx-mono);
  font-size: 20px;
  font-weight: 600;
}
.hx-stat-card .val .u {
  font-size: 11.5px;
  color: var(--hx-muted);
}
.hx-stat-card .val .n.ok { color: var(--hx-ok); }

.hx-diag-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.hx-layer-chips { display: flex; gap: 6px; }
.hx-layer-chip {
  appearance: none;
  border: 1px solid oklch(0.88 0.01 235);
  background: #fff;
  color: oklch(0.52 0.02 240);
  border-radius: 99px;
  padding: 3px 12px;
  font-family: var(--hx-sans);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}
.hx-layer-chip.active {
  border-color: var(--hx-accent);
  background: var(--hx-accent-soft);
  color: oklch(0.38 0.10 240);
}

.hx-chart-legend {
  display: flex;
  gap: 16px;
  font-size: 11.5px;
  color: var(--hx-muted);
  margin-top: 6px;
  flex-wrap: wrap;
}

.hx-map-bins {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px 12px;
  margin-top: 10px;
}
.hx-map-bins span {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-family: var(--hx-mono);
  color: oklch(0.45 0.02 240);
}
.hx-map-bins i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.hx-flag {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid var(--hx-border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.hx-flag.review {
  border-color: var(--hx-warn-border);
  background: var(--hx-warn-soft);
}
.hx-flag.ok {
  border-color: oklch(0.92 0.02 160);
  background: oklch(0.98 0.008 160);
}
.hx-flag .title { font-size: 12.5px; font-weight: 600; }
.hx-flag .detail { font-size: 12px; color: oklch(0.5 0.02 240); margin-top: 1px; }
.hx-flag .level {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--hx-warn);
}
.hx-flag.ok .level { color: oklch(0.45 0.08 160); }

/* —— Parameters —— */
.hx-param-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.hx-param-banner {
  font-size: 12px;
  color: var(--hx-muted);
  background: oklch(0.955 0.01 65);
  border: 1px solid oklch(0.90 0.03 65);
  border-radius: 6px;
  padding: 5px 10px;
}
.hx-param-table {
  background: #fff;
  border: 1px solid var(--hx-border);
  border-radius: 10px;
  overflow-x: auto;
}
.hx-param-cols,
.hx-param-row {
  display: grid;
  grid-template-columns: 44px 110px minmax(120px, 1fr) 110px 96px 150px 132px;
  gap: 0 10px;
  align-items: center;
  padding: 10px 18px;
  font-size: 13px;
  min-width: 780px;
}
.hx-param-cols {
  padding: 9px 18px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--hx-muted);
  border-bottom: 1px solid oklch(0.92 0.008 235);
}
.hx-param-row {
  border-bottom: 1px solid var(--hx-border-soft);
}
.hx-param-row.decided { background: oklch(0.975 0.004 230); }
.hx-param-row .kind {
  font-family: var(--hx-mono);
  font-weight: 600;
  color: var(--hx-accent);
}
.hx-conf {
  display: flex;
  align-items: center;
  gap: 7px;
}
.hx-conf-bar {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: oklch(0.93 0.008 235);
  overflow: hidden;
}
.hx-conf-bar > i {
  display: block;
  height: 100%;
  border-radius: 2px;
}
.hx-conf .pct {
  font-family: var(--hx-mono);
  font-size: 11px;
  color: oklch(0.5 0.02 240);
}
.hx-actions { display: flex; gap: 6px; }

/* —— 3D (static export embed) —— */
.hx-3d-placeholder {
  height: 420px;
  border-radius: 8px;
  border: 1px dashed oklch(0.85 0.01 235);
  background: repeating-linear-gradient(
    45deg,
    oklch(0.97 0.005 235) 0 10px,
    oklch(0.955 0.005 235) 10px 20px
  );
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
}
.hx-3d-placeholder div {
  font-family: var(--hx-mono);
  font-size: 11.5px;
  color: oklch(0.5 0.02 240);
  line-height: 1.8;
}
.hx-3d-frame-wrap {
  position: relative;
  height: min(70vh, 640px);
  min-height: 420px;
  border-radius: 8px;
  border: 1px solid var(--hx-border);
  overflow: hidden;
  /* Explicit light chrome so a black vtk canvas never looks like a "blank tab" without context */
  background: #e8eef5;
}
.hx-3d-frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #000; /* vtk.js Offline view default; overlay/meta/PNG always accompany it */
}
.hx-3d-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 10px 14px;
  background: rgba(12, 18, 32, 0.82);
  color: #f2f6fb;
  font-size: 12px;
  font-family: var(--hx-mono);
  line-height: 1.45;
  pointer-events: none;
}
.hx-3d-png-fallback {
  margin-top: 10px;
  border-radius: 8px;
  border: 1px solid var(--hx-border);
  overflow: hidden;
  background: #0b1220;
  max-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hx-3d-png-fallback img {
  max-width: 100%;
  max-height: 220px;
  object-fit: contain;
  display: block;
}
.hx-3d-meta {
  font-size: 12px;
  color: var(--hx-muted);
  line-height: 1.5;
  margin-top: 10px;
}
.hx-3d-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

/* —— 3D live viewer (S1 chrome + S2 clip) —— */
.hx-3d-live-wrap {
  position: relative;
  height: min(72vh, 680px);
  min-height: 460px;
  border-radius: 8px;
  border: 1px solid var(--hx-border);
  overflow: hidden;
  background: #121820;
}
.hx-3d-live-host {
  position: absolute;
  inset: 0;
}
.hx-3d-live-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
}
.hx-3d-live-canvas:active { cursor: grabbing; }
.hx-3d-legend {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  background: rgba(12, 18, 28, 0.88);
  color: #eef3f8;
  border-radius: 8px;
  padding: 10px 12px;
  min-width: 168px;
  max-width: 220px;
  font-size: 12px;
  line-height: 1.35;
  pointer-events: auto;
}
.hx-3d-legend h3 {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #c5d0dc;
}
.hx-3d-legend label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
  cursor: pointer;
}
.hx-3d-swatch {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  flex: 0 0 12px;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.25) inset;
}
.hx-3d-legend .hx-3d-n {
  margin-left: auto;
  font-family: var(--hx-mono);
  font-size: 10px;
  color: #9aa8b8;
}
.hx-3d-tools {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  background: rgba(12, 18, 28, 0.88);
  color: #eef3f8;
  border-radius: 8px;
  padding: 10px 12px;
  width: 210px;
  font-size: 12px;
}
.hx-3d-tools label {
  display: block;
  margin: 6px 0 2px;
  color: #c5d0dc;
  font-size: 11px;
}
.hx-3d-tools input[type="range"] { width: 100%; }
.hx-3d-tools .hx-3d-tool-row {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.hx-3d-tools button, .hx-3d-mode {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid #3d4c5c;
  background: #1b2532;
  color: #eef3f8;
  cursor: pointer;
}
.hx-3d-mode.active {
  background: #2e6b6a;
  border-color: #4f8f8a;
}
.hx-3d-readout {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 8px;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  pointer-events: none;
  color: #eef3f8;
  font-family: var(--hx-mono);
  font-size: 11px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.65);
}
.hx-3d-scale {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.hx-3d-scale-bar {
  height: 4px;
  background: #eef3f8;
  border-left: 2px solid #eef3f8;
  border-right: 2px solid #eef3f8;
}
.hx-3d-readout-r { text-align: right; }

/* —— Alerts / empty —— */
.hx-alert {
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}
.hx-alert.ok {
  background: oklch(0.93 0.04 160);
  color: oklch(0.30 0.08 160);
  border: 1px solid oklch(0.85 0.05 160);
}
.hx-alert.err {
  background: oklch(0.96 0.03 25);
  color: oklch(0.40 0.12 25);
  border: 1px solid oklch(0.88 0.05 25);
}
.hx-alert.warn {
  background: oklch(0.97 0.03 85);
  color: oklch(0.38 0.08 70);
  border: 1px solid oklch(0.88 0.06 80);
}
.hx-alert.info {
  background: oklch(0.96 0.02 240);
  color: oklch(0.35 0.05 245);
  border: 1px solid oklch(0.88 0.03 240);
}
.hx-alert-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
  align-items: center;
}
.hx-alert-actions .hx-btn {
  text-decoration: none;
}
.hx-empty {
  padding: 24px 18px;
  text-align: center;
  color: var(--hx-muted);
  font-size: 13px;
}

/* —— API loading skeletons (not empty-projects truth) —— */
.hx-skeleton-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 4px;
}
.hx-skeleton-stack.dim { opacity: 0.55; }
.hx-skel-card {
  height: 88px;
  border-radius: 10px;
  background: linear-gradient(
    90deg,
    oklch(0.94 0.008 235) 0%,
    oklch(0.97 0.005 235) 45%,
    oklch(0.94 0.008 235) 90%
  );
  background-size: 200% 100%;
  animation: hx-shimmer 1.5s linear infinite;
  border: 1px solid var(--hx-border-soft);
}
.hx-skel-card.short { height: 52px; width: 70%; }

/* —— Project dropdown (app-wide popup pattern) —— */
.hx-project-wrap {
  position: relative;
  z-index: 50;
}
/* Invisible full-screen dismiss layer under the menu (Victor pattern). */
.hx-popup-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: transparent;
  cursor: default;
}
.hx-project-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: #fff;
  color: var(--hx-fg);
  border: 1px solid var(--hx-border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(20, 30, 50, 0.12);
  min-width: 260px;
  z-index: 50;
  padding: 6px;
  outline: none;
}
.hx-project-menu button {
  display: block;
  width: 100%;
  text-align: left;
  appearance: none;
  background: none;
  border: none;
  border-radius: 6px;
  padding: 8px 10px;
  font-family: var(--hx-sans);
  font-size: 13px;
  cursor: pointer;
  color: var(--hx-fg);
}
.hx-project-menu button:hover:not(:disabled) { background: oklch(0.96 0.01 240); }
.hx-project-menu button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.hx-project-menu .new {
  border-top: 1px solid var(--hx-border-soft);
  margin-top: 4px;
  padding-top: 8px;
  color: var(--hx-accent);
  font-weight: 600;
}
.hx-menu-hint {
  padding: 8px 10px;
  font-size: 12px;
  color: var(--hx-muted);
  line-height: 1.4;
}

.hx-create-row {
  display: flex;
  gap: 8px;
  align-items: end;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.hx-create-row label {
  display: block;
  font-size: 12px;
  color: var(--hx-muted);
  margin-bottom: 4px;
}
.hx-input {
  display: block;
  padding: 7px 10px;
  font-size: 13px;
  font-family: var(--hx-sans);
  border: 1px solid var(--hx-border);
  border-radius: 7px;
  min-width: 220px;
  background: #fff;
  color: var(--hx-fg);
}
.hx-input:focus {
  outline: 2px solid oklch(0.70 0.08 240);
  outline-offset: 1px;
}

/* —— Reports page —— */
.hx-main-wide { max-width: 1600px; }
.hx-report-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: end;
  margin-bottom: 14px;
}
.hx-report-bar label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--hx-muted);
}
.hx-report-bar select,
.hx-report-bar input[type="date"] {
  font-family: var(--hx-sans);
  font-size: 13px;
  padding: 6px 8px;
  border: 1px solid var(--hx-border);
  border-radius: 7px;
  background: #fff;
  color: var(--hx-fg);
  min-width: 160px;
}
.hx-report-check {
  flex-direction: row !important;
  align-items: center;
  gap: 6px !important;
  padding-bottom: 6px;
}
.hx-kb-table.hx-report-table tbody tr { cursor: default; }
.hx-report-print-meta { display: none; }

@media print {
  .hx-no-print,
  .aq-auth-chrome,
  .hx-header { display: none !important; }
  .hx-report-print-meta { display: block; }
  .hx-shell, .hx-main, .hx-main-wide {
    max-width: none;
    padding: 0;
    margin: 0;
  }
  .hx-card { border: none; }
  .hx-kb-table th { background: #fff; }
}

/* —— Responsive —— */
@media (max-width: 1100px) {
  .hx-overview-top { grid-template-columns: 1fr; }
  .hx-overview-bottom { grid-template-columns: 1fr; }
  .hx-stats { grid-template-columns: repeat(3, 1fr); }
  .hx-diag-grid { grid-template-columns: 1fr; }
  .hx-runs-layout { flex-direction: column; }
  .hx-run-detail { width: 100%; flex: 1 1 auto; }
}

.hx-figure-wrap {
  position: relative;
  display: inline-block;
  max-width: 100%;
  cursor: crosshair;
}
.hx-figure-wrap img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
  border: 1px solid var(--hx-border-soft);
}
.hx-pin {
  position: absolute;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  margin-top: -7px;
  border-radius: 50%;
  background: #c2410c;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.25);
  pointer-events: none;
}
.hx-pin.pending { background: var(--hx-accent); }
.hx-drawer {
  border: 1px solid var(--hx-border);
  border-radius: 10px;
  background: var(--hx-card);
  padding: 10px 12px;
  margin: 10px 0 14px;
}
.hx-drawer summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
}
.hx-orient {
  display: inline-flex;
  gap: 4px;
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .hx-stats { grid-template-columns: 1fr 1fr; }
  .hx-runs-cols,
  .hx-run-row {
    grid-template-columns: 70px 1fr 70px;
  }
  .hx-runs-cols span:nth-child(3),
  .hx-runs-cols span:nth-child(5),
  .hx-run-row > :nth-child(3),
  .hx-run-row > :nth-child(5) {
    display: none;
  }
}
