/* WQ Alpha Pilot — dashboard UI (taste-skill: calm quant cockpit, no AI-slop gradients) */
:root {
  --bg: #f4f6f9;
  --bg-elevated: #ffffff;
  --bg-subtle: #e8ecf2;
  --surface: #ffffff;
  --border: #d4dae3;
  --border-strong: #b8c2d0;
  --text: #141c2b;
  --text-secondary: #3d4a5f;
  --muted: #64748b;
  --top: #0f172a;
  --top-muted: #94a3b8;
  --accent: #0d6e6e;
  --accent-soft: #e6f4f4;
  --accent-hover: #0a5555;
  --accent-glow: rgba(13, 110, 110, 0.22);
  --good: #15803d;
  --warn: #c2410c;
  --danger: #b91c1c;
  --avg: #64748b;
  --gold: #b8860b;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --font-sans: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-mono: "Cascadia Code", "JetBrains Mono", ui-monospace, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 120% 80% at 100% -20%, rgba(13, 110, 110, 0.07), transparent 50%),
    radial-gradient(ellipse 80% 50% at 0% 100%, rgba(15, 23, 42, 0.04), transparent 45%);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  min-height: 100vh;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 36px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.auth-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), #14b8a6);
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 24px;
}

.brand h1 {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--top);
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.06em;
  font-size: 0.8rem;
}

.brand-mark.sm {
  width: 34px;
  height: 34px;
  font-size: 0.7rem;
  border-radius: 9px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.8125rem;
  line-height: 1.55;
}

.hidden {
  display: none !important;
}

.error {
  color: var(--danger);
  font-size: 0.875rem;
}

.auth-card label {
  display: block;
  margin-top: 14px;
  margin-bottom: 6px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.auth-card input {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.auth-card input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.topbar {
  background: var(--top);
  color: #f1f5f9;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: var(--shadow-sm);
}

.topbar-inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.topbar-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.875rem;
  color: var(--top-muted);
}

.tab-bar-wrap {
  max-width: 1320px;
  margin: 0 auto;
  padding: 16px 24px 0;
}

.tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.tab {
  padding: 10px 18px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  border-radius: calc(var(--radius-md) - 4px);
  transition: background 0.15s ease, color 0.15s ease;
}

.tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.6);
}

.tab.active {
  color: var(--accent);
  font-weight: 600;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 20px 24px 40px;
}

.panel {
  display: none;
  animation: panel-in 0.25s ease;
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.panel.active {
  display: block;
}

.panel > h2 {
  margin: 0 0 8px;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.panel > h3 {
  margin: 20px 0 10px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.challenge-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.challenge-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, var(--gold), #d4a017);
}

.challenge-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--bg-subtle);
}

.challenge-head h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}

.challenge-inline-stats {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 20px;
}

.challenge-inline-stat {
  font-size: 0.8125rem;
  color: var(--muted);
}

.challenge-inline-stat strong {
  margin-left: 6px;
  color: var(--text);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.challenge-link {
  font-size: 0.8125rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.challenge-link:hover {
  text-decoration: underline;
}

.challenge-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.challenge-toggle {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.challenge-toggle:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.challenge-toggle-icon {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.2s ease;
}

.challenge-toggle[aria-expanded="true"] .challenge-toggle-icon {
  transform: rotate(180deg);
}

.challenge-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 14px;
}

.challenge-stats h3,
.challenge-goals h3 {
  margin: 0 0 10px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.challenge-stats dl {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.stat-row {
  display: grid;
  grid-template-columns: 88px 1fr;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--bg-subtle);
  background: var(--bg);
}

.stat-row:last-child {
  border-bottom: none;
}

.stat-row dt {
  font-weight: 500;
  color: var(--muted);
  font-size: 0.8125rem;
}

.stat-row dd {
  margin: 0;
  text-align: right;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.level-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 8px;
  border-radius: 50%;
  vertical-align: -1px;
  background: var(--gold);
  box-shadow: 0 0 0 2px rgba(184, 134, 11, 0.25);
}

.level-dot-inline {
  width: 8px;
  height: 8px;
  margin-right: 6px;
  vertical-align: -2px;
}

.challenge-inline-level-strong {
  display: inline-flex;
  align-items: center;
  margin-left: 4px;
}

.challenge-goals {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}

.challenge-goals ul {
  margin: 0;
  padding-left: 18px;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.challenge-goals li {
  margin-bottom: 8px;
}

.btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  transition: background 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn.primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 2px var(--accent-glow);
}

.btn.primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.08);
  color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.btn.ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.14);
}

.btn.danger.ghost {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(185, 28, 28, 0.35);
}

.btn.full {
  width: 100%;
  margin-top: 20px;
}

.alpha-summary-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 14px;
  margin-bottom: 14px;
}

.split-sync {
  position: relative;
  display: inline-flex;
  align-items: stretch;
  border-radius: var(--radius-sm);
  overflow: visible;
  box-shadow: var(--shadow-sm);
}

.split-sync .btn.primary {
  margin: 0;
  border-radius: 0;
}

.split-sync-main {
  border-radius: var(--radius-sm) 0 0 var(--radius-sm) !important;
  padding-left: 18px;
  padding-right: 16px;
  height: 42px;
  line-height: 42px;
  padding-top: 0;
  padding-bottom: 0;
}

.split-sync-caret {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0 !important;
  padding: 0 12px;
  border-left: 1px solid rgba(255, 255, 255, 0.2) !important;
  min-width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.caret-icon {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.split-sync-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  margin: 0;
  padding: 6px;
  list-style: none;
  min-width: 168px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  z-index: 50;
}

.split-sync-menu li button {
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  border: none;
  background: transparent;
  font-size: 0.875rem;
  cursor: pointer;
  color: var(--text);
  border-radius: 6px;
  font-family: inherit;
}

.split-sync-menu li button:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.alpha-filter-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.alpha-filter-btn {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  height: 44px;
  padding: 0 12px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  border-left-width: 3px;
  text-align: left;
}

.alpha-filter-btn.all {
  border-left-color: #2563eb;
}
.alpha-filter-btn.backtested {
  border-left-color: #0d9488;
}
.alpha-filter-btn.qualified {
  border-left-color: #7c3aed;
}
.alpha-filter-btn.submittable {
  border-left-color: var(--warn);
}
.alpha-filter-btn.submitted {
  border-left-color: var(--avg);
}

.alpha-filter-btn:hover {
  background: var(--bg);
  box-shadow: var(--shadow-sm);
}

.alpha-filter-btn.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
  color: var(--accent-hover);
}

.hint-details {
  margin: 0 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 0.8125rem;
}

.hint-details summary {
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 600;
  color: var(--text-secondary);
  list-style: none;
}

.hint-details summary::-webkit-details-marker {
  display: none;
}

.hint-details[open] summary {
  border-bottom: 1px solid var(--bg-subtle);
}

.hint-details .hint-body {
  padding: 12px 14px;
  color: var(--muted);
  line-height: 1.6;
}

.hint-details code {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  background: var(--bg);
  padding: 1px 5px;
  border-radius: 4px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  max-height: min(70vh, 720px);
}

.brain-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.brain-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  text-align: left;
  padding: 11px 14px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.brain-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--bg-subtle);
  vertical-align: top;
  font-variant-numeric: tabular-nums;
}

.brain-table tbody tr {
  transition: background 0.12s ease;
}

.brain-table tbody tr:hover {
  background: var(--accent-soft);
}

.brain-table tbody tr:nth-child(even) {
  background: rgba(244, 246, 249, 0.6);
}

.brain-table tbody tr:nth-child(even):hover {
  background: var(--accent-soft);
}

.brain-table td.table-empty-hint {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
  font-size: 0.9rem;
  font-variant-numeric: normal;
}

.alpha-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-top: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.alpha-pager .pager-meta {
  font-size: 0.8125rem;
  color: var(--muted);
}

.alpha-pager .pager-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-left: auto;
}

.alpha-pager .btn.ghost {
  background: var(--bg);
  color: var(--accent);
  border: 1px solid var(--border);
}

.alpha-pager .btn.ghost:hover:not(:disabled) {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.alpha-pager button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

#alpha-status-msg {
  margin-top: 10px;
  font-size: 0.8125rem;
  color: var(--muted);
}

.sync-progress {
  margin: 12px 0;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.sync-progress-track {
  height: 6px;
  background: var(--bg-subtle);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 8px;
}

.sync-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #14b8a6);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.sync-progress-text {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.brain-table tr.skeleton-row td {
  padding: 14px;
}

.skeleton-bar {
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--bg-subtle) 0%, #dfe4eb 50%, var(--bg-subtle) 100%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.1s ease-in-out infinite;
}

@keyframes skeleton-shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

.expr-cell {
  max-width: 440px;
  word-break: break-all;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-variant-numeric: normal;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.badge.good {
  background: #dcfce7;
  color: var(--good);
}

.badge.avg {
  background: #f1f5f9;
  color: var(--avg);
}

.badge.sub {
  background: var(--accent-soft);
  color: var(--accent-hover);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.filter-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  transition: border-color 0.15s ease;
}

.filter-card:hover {
  border-color: var(--border-strong);
}

.filter-card h4 {
  margin: 0 0 6px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.filter-card .val {
  font-size: 1.05rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.pipeline-controls {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin: 16px 0;
}

.pipeline-controls .row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  margin-bottom: 12px;
}

.pipeline-controls label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.pipeline-controls select,
.pipeline-controls input[type="number"] {
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-family: inherit;
  font-size: 0.875rem;
}

.pipeline-controls select:focus,
.pipeline-controls input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.pipeline-auto-submit-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  cursor: pointer;
}

.input-mono {
  width: 100%;
  max-width: 720px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.5;
  resize: vertical;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input-mono:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.pill {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.code-block {
  background: #0f172a;
  color: #e2e8f0;
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  overflow: auto;
  max-height: 420px;
  font-size: 0.78rem;
  font-family: var(--font-mono);
  line-height: 1.55;
  border: 1px solid #1e293b;
}

.card-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ai-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  transition: border-color 0.15s ease;
}

.ai-card:hover {
  border-color: var(--border-strong);
}

.ai-card h4 {
  margin: 0 0 8px;
  font-size: 0.875rem;
  font-weight: 600;
}

.ai-card ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 0.8125rem;
}

.ai-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.ai-chat-shell {
  margin: 16px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}

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

.ai-chat-head h3 {
  margin: 0 0 4px;
  font-size: 0.95rem;
}

.ai-chat-log {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 520px;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
}

.ai-chat-message {
  display: flex;
}

.ai-chat-message.user {
  justify-content: flex-end;
}

.ai-chat-message.user p {
  max-width: min(760px, 90%);
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  white-space: pre-wrap;
}

.ai-chat-message.assistant {
  justify-content: flex-start;
}

.ai-chat-message.pending {
  opacity: 0.72;
}

.ai-chat-card {
  width: min(900px, 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 12px 14px;
}

.ai-chat-card.error {
  border-color: #fecaca;
  background: #fef2f2;
  color: var(--danger);
}

.ai-chat-card + .ai-chat-card {
  margin-top: 10px;
}

.ai-chat-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 6px;
}

.ai-chat-card h4 {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.ai-chat-card p {
  margin: 6px 0;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  line-height: 1.55;
}

.ai-chat-expr-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.ai-chat-expr {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  padding: 10px 12px;
}

.ai-chat-expr code {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  word-break: break-all;
  color: var(--text-secondary);
}

.ai-chat-expr-actions,
.ai-chat-prompts,
.ai-chat-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ai-chat-expr-actions {
  margin-top: 8px;
}

.ai-chat-expr-actions .btn,
.ai-chat-prompts .btn {
  padding: 7px 10px;
  font-size: 0.75rem;
}

.ai-chat-expr-actions .btn.ghost,
.ai-chat-prompts .btn.ghost {
  background: var(--surface);
  color: var(--accent);
  border: 1px solid var(--border);
}

.ai-chat-expr-actions .btn.ghost:hover:not(:disabled),
.ai-chat-prompts .btn.ghost:hover:not(:disabled) {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.ai-chat-prompts {
  margin: 12px 0 10px;
}

.ai-chat-form {
  align-items: stretch;
}

.ai-chat-form textarea {
  flex: 1 1 420px;
  min-height: 74px;
}

.ai-chat-form .btn {
  align-self: stretch;
}

.ai-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 12px;
  margin: 12px 0 16px;
}

.ai-guide-card,
.ai-diagnosis {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}

.ai-guide-head,
.ai-diagnosis-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.ai-guide-card h3,
.ai-diagnosis h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
  font-weight: 700;
}

.ai-guide-steps {
  margin: 8px 0 12px;
  padding-left: 20px;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  line-height: 1.65;
}

.ai-rule-table {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.ai-rule-table > div {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: var(--bg);
}

.ai-rule-table strong,
.ai-rule-table span {
  display: block;
  font-size: 0.78rem;
}

.ai-rule-table span {
  margin-top: 4px;
  color: var(--muted);
}

.ai-seed-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ai-seed-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: var(--bg);
}

.ai-seed-item code {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
  word-break: break-all;
}

.ai-diagnosis {
  margin-top: 14px;
  border-left: 4px solid var(--avg);
}

.ai-diagnosis.good {
  border-left-color: var(--good);
}

.ai-diagnosis.warn {
  border-left-color: var(--warn);
}

.ai-diagnosis.danger {
  border-left-color: var(--danger);
}

.ai-verdict-badge {
  display: inline-flex;
  margin-bottom: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ai-diagnosis-explain {
  margin: 8px 0 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.ai-diagnosis-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.ai-diagnosis-metric {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: var(--bg);
}

.ai-diagnosis-metric em,
.ai-diagnosis-metric span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-style: normal;
}

.ai-diagnosis-metric strong {
  display: block;
  margin: 3px 0;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}

.ai-diagnosis-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}

.ai-diagnosis-section {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  background: var(--bg);
}

.ai-diagnosis-section h4 {
  margin: 0 0 8px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.ai-diagnosis-section ul {
  margin: 0;
  padding-left: 18px;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  line-height: 1.6;
}

.ai-diagnosis-section code {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  word-break: break-all;
}

.ai-variants {
  margin-top: 14px;
}

.ai-library-hit,
.ai-variant-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}

.ai-library-hit {
  margin-bottom: 12px;
  border-left: 4px solid var(--accent);
}

.ai-library-hit h4,
.ai-variants-head h3,
.ai-variant-card h4 {
  margin: 0 0 8px;
  font-size: 0.9rem;
}

.ai-variants-head {
  margin: 0 0 10px;
}

.ai-variant-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.ai-variant-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.ai-variant-card code {
  display: block;
  margin: 8px 0 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
  word-break: break-all;
}

.ai-variant-card p {
  margin: 6px 0;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  line-height: 1.55;
}

.ai-variant-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

/* Pipeline round output */
.pipeline-output {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin-top: 8px;
}

.pipeline-output-empty {
  margin: 0;
  font-size: 0.875rem;
}

.pipeline-output-running .pipeline-progress-track {
  background: var(--bg-subtle);
}

.pipeline-output-running.pipeline-progress-indeterminate .pipeline-progress-fill {
  width: 38% !important;
  animation: pipeline-indeterminate 1.4s ease-in-out infinite;
}

.pipeline-progress-detail {
  margin: -8px 0 14px;
}

.pipeline-funnel-placeholder .pipeline-funnel-step {
  opacity: 0.55;
}

@keyframes pipeline-indeterminate {
  0% {
    transform: translateX(-120%);
  }
  100% {
    transform: translateX(320%);
  }
}

.pipeline-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 10px;
}

.pipeline-progress-head h4 {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
}

.pipeline-progress-pct {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.pipeline-progress-track {
  height: 8px;
  background: var(--bg-subtle);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 16px;
}

.pipeline-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #14b8a6);
  border-radius: 999px;
  transition: width 0.45s ease;
  min-width: 0;
}

.pipeline-funnel {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 18px;
}

.pipeline-funnel-step {
  text-align: center;
  padding: 10px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  min-width: 0;
}

.pipeline-funnel-step.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.pipeline-funnel-step.done {
  border-color: #86efac;
  background: #f0fdf4;
}

.pipeline-funnel-step.stalled {
  border-color: #fed7aa;
  background: #fff7ed;
}

.pipeline-funnel-step .step-label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pipeline-funnel-step .step-val {
  display: block;
  font-size: 1.05rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.pipeline-live-log {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #111827;
  overflow: hidden;
  margin-top: 14px;
}

.pipeline-live-log-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
}

.pipeline-live-log-head h4 {
  margin: 0;
  color: #e5e7eb;
  font-size: 0.8125rem;
  font-weight: 600;
}

.pipeline-live-log-count {
  color: #94a3b8;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.pipeline-live-log-list {
  max-height: 220px;
  overflow: auto;
  padding: 8px 0;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.5;
}

.pipeline-live-log-row {
  display: grid;
  grid-template-columns: 72px minmax(70px, 0.6fr) 42px minmax(120px, 1.8fr) minmax(120px, 1.2fr);
  align-items: start;
  gap: 8px;
  padding: 4px 12px;
  color: #d1d5db;
}

.pipeline-live-log-row.warn {
  color: #fed7aa;
}

.pipeline-live-log-row.error {
  color: #fecaca;
}

.pipeline-live-log-row + .pipeline-live-log-row {
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.pipeline-live-log-time,
.pipeline-live-log-pct {
  color: #94a3b8;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.pipeline-live-log-phase {
  color: #5eead4;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pipeline-live-log-msg,
.pipeline-live-log-data {
  min-width: 0;
  overflow-wrap: anywhere;
}

.pipeline-live-log-data {
  color: #a7f3d0;
  background: transparent;
  font-family: inherit;
  font-size: inherit;
}

.pipeline-live-log-empty {
  padding: 14px 12px;
  color: #94a3b8;
}

.pipeline-result-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: 16px;
  margin-bottom: 14px;
}

.pipeline-submit-box {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  background: var(--bg);
}

.pipeline-submit-box h4 {
  margin: 0 0 10px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.pipeline-submit-none {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.08em;
}

.pipeline-submit-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pipeline-submit-item {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.8125rem;
}

.pipeline-submit-item .expr {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
  word-break: break-all;
  margin-bottom: 6px;
}

.pipeline-submit-item .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.pipeline-expr-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.pipeline-expr-actions .btn,
.pipeline-variant-head .btn {
  padding: 7px 10px;
  font-size: 0.75rem;
}

.pipeline-submit-item .btn.ghost,
.pipeline-top-item .btn.ghost,
.pipeline-variant-result .btn.ghost {
  background: var(--bg);
  color: var(--accent);
  border: 1px solid var(--border);
}

.pipeline-submit-item .btn.ghost:hover:not(:disabled),
.pipeline-top-item .btn.ghost:hover:not(:disabled),
.pipeline-variant-result .btn.ghost:hover:not(:disabled) {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.pipeline-expr-feedback {
  margin-top: 10px;
}

.pipeline-expr-feedback-note {
  margin: 0;
  padding: 10px 12px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--muted);
  font-size: 0.75rem;
}

.pipeline-live-result,
.pipeline-variant-result {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 12px;
}

.pipeline-live-result-head,
.pipeline-variant-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.pipeline-live-result-head h4,
.pipeline-variant-result h4 {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.pipeline-live-result-head span {
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
}

.pipeline-live-result-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.pipeline-live-result-grid > div {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  padding: 8px 10px;
  min-width: 0;
}

.pipeline-live-result-grid em {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  font-style: normal;
}

.pipeline-live-result-grid strong {
  display: block;
  margin-top: 2px;
  color: var(--text);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.pipeline-live-result p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.75rem;
}

.pipeline-variant-result ol {
  margin: 0;
  padding-left: 18px;
}

.pipeline-variant-result li + li {
  margin-top: 12px;
}

.pipeline-variant-head strong {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.pipeline-variant-result code {
  display: block;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  word-break: break-all;
}

.pipeline-variant-result p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.5;
}

.pipeline-top-box {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  background: var(--bg);
  margin-bottom: 14px;
}

.pipeline-top-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.pipeline-top-head h4 {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.pipeline-top-head span {
  color: var(--muted);
  font-size: 0.75rem;
}

.pipeline-top-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pipeline-top-item {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  min-width: 0;
}

.pipeline-top-rank {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.pipeline-top-body {
  min-width: 0;
}

.pipeline-top-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

.pipeline-top-badge {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 0.6875rem;
  font-weight: 600;
}

.pipeline-top-badge.pass,
.pipeline-top-badge.keep {
  background: #dcfce7;
  border-color: #86efac;
  color: var(--good);
}

.pipeline-top-badge.drop {
  background: #f1f5f9;
  color: var(--muted);
}

.pipeline-top-item p {
  margin: 6px 0 0;
  color: var(--text-secondary);
  font-size: 0.75rem;
  line-height: 1.5;
}

.pipeline-diagnosis {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  background: var(--bg);
}

.pipeline-diagnosis h4 {
  margin: 0 0 8px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.pipeline-diagnosis-summary {
  margin: 0 0 10px;
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--text);
}

.pipeline-reject-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 10px 0 12px;
}

.pipeline-reject-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 2fr) auto;
  gap: 10px;
  align-items: center;
  font-size: 0.8125rem;
}

.pipeline-reject-label {
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pipeline-reject-track {
  height: 6px;
  background: var(--bg-subtle);
  border-radius: 999px;
  overflow: hidden;
}

.pipeline-reject-fill {
  height: 100%;
  background: #fb923c;
  border-radius: 999px;
}

.pipeline-reject-count {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  min-width: 2.5em;
  text-align: right;
}

.pipeline-suggestions {
  margin: 0;
  padding-left: 18px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

.pipeline-suggestions li + li {
  margin-top: 6px;
}

.pipeline-output-meta {
  margin-top: 12px;
  font-size: 0.75rem;
  color: var(--muted);
}

/* FASTEXPR annotated expression + hover dictionary */
.fastexpr-annotated-wrap {
  margin-top: 10px;
}

.fastexpr-annotated-wrap.compact {
  margin-top: 8px;
}

.fastexpr-annotated-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
  margin-bottom: 6px;
}

.fastexpr-annotated-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.fastexpr-annotated {
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  min-height: 44px;
}

.fastexpr-annotated.has-expr {
  border-style: solid;
  background: var(--surface);
}

.fastexpr-annotated-empty {
  margin: 0;
}

.fastexpr-annotated-inner,
.fastexpr-annotated.compact-inline {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.65;
  word-break: break-all;
  color: var(--text-secondary);
}

.fastexpr-raw {
  color: var(--text-secondary);
}

.fastexpr-part {
  cursor: help;
  border-radius: 4px;
  padding: 0 1px;
  border-bottom: 1px dotted var(--accent);
  color: var(--accent-hover);
  transition: background 0.12s ease, color 0.12s ease;
}

.fastexpr-part:hover,
.fastexpr-part:focus {
  outline: none;
  background: var(--accent-soft);
  color: var(--accent-hover);
}

.fastexpr-part.fastexpr-num {
  border-bottom-color: #d97706;
  color: #b45309;
}

.fastexpr-part.fastexpr-num:hover,
.fastexpr-part.fastexpr-num:focus {
  background: #fff7ed;
  color: #9a3412;
}

.fastexpr-part.fastexpr-part-llm {
  border-bottom-color: #7c3aed;
  color: #6d28d9;
}

.fastexpr-part.fastexpr-part-llm:hover,
.fastexpr-part.fastexpr-part-llm:focus {
  background: #f5f3ff;
  color: #5b21b6;
}

.fastexpr-part.fastexpr-part-db {
  border-bottom-color: #0284c7;
  color: #0369a1;
}

.fastexpr-part.fastexpr-part-db:hover,
.fastexpr-part.fastexpr-part-db:focus {
  background: #f0f9ff;
  color: #075985;
}

.fastexpr-part.fastexpr-part-pending {
  border-bottom-style: dashed;
  border-bottom-color: #a78bfa;
  color: #7c3aed;
  animation: fastexpr-pulse 1.2s ease-in-out infinite;
}

@keyframes fastexpr-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.65;
  }
}

.fastexpr-tooltip-source {
  font-size: 0.6875rem;
  color: #94a3b8;
  margin-bottom: 6px;
}

.fastexpr-tooltip {
  position: fixed;
  z-index: 1200;
  max-width: min(320px, calc(100vw - 24px));
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--top);
  color: #f1f5f9;
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(255, 255, 255, 0.08);
  pointer-events: none;
}

.fastexpr-tooltip-kind {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #94a3b8;
  margin-bottom: 2px;
}

.fastexpr-tooltip-name {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 600;
  color: #e2e8f0;
  margin-bottom: 6px;
}

.fastexpr-tooltip-hint {
  font-size: 0.8125rem;
  line-height: 1.5;
  color: #cbd5e1;
}

.ai-score-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
}

.ai-score-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
  margin-bottom: 12px;
}

.ai-score-metric {
  font-size: 0.875rem;
}

.ai-score-metric em {
  font-style: normal;
  color: var(--muted);
  margin-right: 4px;
}

.ai-score-metric strong {
  font-variant-numeric: tabular-nums;
}

.ai-score-metric.pill.good {
  background: #dcfce7;
  color: var(--good);
  border-color: #86efac;
}

.ai-score-metric.pill.warn {
  background: #ffedd5;
  color: var(--warn);
  border-color: #fdba74;
}

.ai-score-reasons h4 {
  margin: 12px 0 6px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.ai-score-reasons ul {
  margin: 0;
  padding-left: 18px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.ai-score-disclaimer {
  margin: 12px 0 0;
}

.ai-score-raw {
  margin-top: 12px;
}

.code-block.small {
  max-height: 220px;
  font-size: 0.75rem;
}

@media (max-width: 900px) {
  .ai-workbench,
  .ai-diagnosis-grid {
    grid-template-columns: 1fr;
  }

  .ai-chat-head,
  .ai-chat-form {
    flex-direction: column;
  }

  .ai-chat-message.user p,
  .ai-chat-card {
    max-width: 100%;
    width: 100%;
  }

  .ai-rule-table,
  .ai-diagnosis-metrics {
    grid-template-columns: 1fr;
  }

  .ai-guide-head,
  .ai-diagnosis-head {
    flex-direction: column;
  }

  .pipeline-funnel {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .pipeline-result-grid {
    grid-template-columns: 1fr;
  }

  .pipeline-top-list {
    grid-template-columns: 1fr;
  }

  .pipeline-reject-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .pipeline-live-log-row {
    grid-template-columns: 62px 1fr 38px;
  }

  .pipeline-live-log-msg,
  .pipeline-live-log-data {
    grid-column: 1 / -1;
  }

  .alpha-summary-wrap {
    grid-template-columns: 1fr;
  }

  .alpha-filter-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .split-sync {
    justify-self: start;
  }

  .container,
  .topbar-inner,
  .tab-bar-wrap {
    padding-left: 16px;
    padding-right: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .panel,
  .skeleton-bar,
  .btn,
  .alpha-filter-btn,
  .brain-table tbody tr,
  .pipeline-output-running.pipeline-progress-indeterminate .pipeline-progress-fill,
  .fastexpr-part.fastexpr-part-pending {
    animation: none;
    transition: none;
  }
}
