/* MarketOS components — Fanout Design System.

   Tokens only. A hex literal in this file is a bug — see 00-tokens.css and the
   guard in tests/api/test_design_system.py. */

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  border: 1px solid transparent;
  border-radius: var(--r-button);
  padding: 8px 16px;
  font: 500 13px var(--sans);
  letter-spacing: .01em;
  cursor: pointer;
  text-decoration: none;
  transition: filter var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.btn:hover {
  filter: brightness(1.08);
  text-decoration: none;
}
.btn:active {
  filter: brightness(.95);
  transform: translateY(.5px);
}
.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
  filter: none;
}

.btn-primary,
.btn--primary,
a.btn-primary,
a.btn--primary {
  background: var(--signal);
  color: var(--signal-text);
  border-color: transparent;
  text-decoration: none;
}
.btn-primary:hover,
.btn--primary:hover,
a.btn-primary:hover,
a.btn--primary:hover {
  background: var(--math-blue);
  color: var(--signal-text);
  text-decoration: none;
  filter: brightness(1.06);
}

.btn-secondary,
.btn--secondary,
a.btn-secondary,
a.btn--secondary {
  background: var(--surface);
  color: var(--ink);
  border: var(--bd-strong);
  box-shadow: var(--e-1);
  text-decoration: none;
}
.btn-secondary:hover,
.btn--secondary:hover,
a.btn-secondary:hover,
a.btn--secondary:hover {
  background: var(--surface-3);
  border-color: var(--border-strong);
  color: var(--ink);
  text-decoration: none;
}

.btn-quiet,
.btn--subtle {
  background: transparent;
  color: var(--ink-dim);
  border-color: transparent;
  padding: 8px 6px;
}
.btn-quiet:hover,
.btn--subtle:hover {
  color: var(--ink);
  text-decoration: underline;
}

.btn--sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn--lg {
  padding: 12px 22px;
  font-size: 14px;
  font-weight: 500;
}

/* ---------- inputs & dropdowns ---------- */

select,
input[type="text"],
input[type="number"],
input[type="search"],
input[type="date"] {
  background-color: var(--surface);
  color: var(--ink);
  border: var(--bd-strong);
  border-radius: var(--r-md);
  padding: 7.5px 12px;
  font: 500 13px/1.4 var(--sans);
  height: 38px;
  box-sizing: border-box;
  min-width: 152px;
  box-shadow: var(--e-1);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
}
select {
  cursor: pointer;
}
select option {
  background-color: var(--surface);
  color: var(--ink);
  padding: 6px 10px;
}
input[type="text"]::placeholder {
  color: var(--faint);
}
select:hover,
input[type="text"]:hover {
  border-color: var(--border-strong);
}
select:focus,
input[type="text"]:focus {
  outline: none;
  border-color: var(--signal);
  box-shadow: var(--shadow-focus);
}

/* ---------- custom dropdown component & animations ---------- */

.custom-dropdown {
  position: relative;
  display: inline-block;
  width: 100%;
}

.custom-dropdown--universe {
  width: auto;
  display: inline-flex;
  align-items: center;
}

/* Visually hidden native select for form posts and accessibility */
.custom-dropdown__native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Dropdown trigger button */
.custom-dropdown__trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
  background-color: var(--surface);
  color: var(--ink);
  border: var(--bd-strong);
  border-radius: var(--r-md);
  padding: 7.5px 12px;
  font: 500 13px var(--sans);
  cursor: pointer;
  text-align: left;
  user-select: none;
  box-shadow: var(--e-1);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}

.custom-dropdown__trigger:hover {
  border-color: var(--border-strong);
  background-color: var(--surface-3);
}

.custom-dropdown__trigger:focus,
.custom-dropdown__trigger:focus-visible,
.custom-dropdown.is-open .custom-dropdown__trigger {
  outline: none;
  border-color: var(--signal);
  box-shadow: var(--shadow-focus);
}

.custom-dropdown__value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1 1 auto;
}

/* Chevron indicator with rotation animation */
.custom-dropdown__chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  color: var(--muted);
  flex-shrink: 0;
  transform-origin: center;
  transition: transform var(--dur) var(--ease), color var(--dur-fast) var(--ease);
}

.custom-dropdown:hover .custom-dropdown__chevron {
  color: var(--ink-dim);
}

.custom-dropdown.is-open .custom-dropdown__chevron {
  transform: rotate(180deg);
  color: var(--signal);
}

/* Floating animated dropdown menu */
.custom-dropdown__menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 100%;
  width: max-content;
  max-width: 380px;
  z-index: 1000;
  background: var(--surface);
  border: var(--bd-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--e-2);
  padding: 4px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-6px) scale(0.98);
  transform-origin: top center;
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease), visibility var(--dur) var(--ease);
}

.custom-dropdown.is-open .custom-dropdown__menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* Upward flip when close to viewport bottom */
.custom-dropdown.is-flipped .custom-dropdown__menu {
  top: auto;
  bottom: calc(100% + 6px);
  transform-origin: bottom center;
  transform: translateY(6px) scale(0.98);
}

.custom-dropdown.is-open.is-flipped .custom-dropdown__menu {
  transform: translateY(0) scale(1);
}

/* Right alignment */
.custom-dropdown--align-right .custom-dropdown__menu {
  left: auto;
  right: 0;
}

/* Options container */
.custom-dropdown__options {
  max-height: 250px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 2px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.custom-dropdown__options::-webkit-scrollbar {
  width: 5px;
}
.custom-dropdown__options::-webkit-scrollbar-track {
  background: transparent;
}
.custom-dropdown__options::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: var(--r-pill);
}

/* Dropdown option item */
.custom-dropdown__option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding: 7px 10px;
  border-radius: var(--r-sm);
  font: 500 12.5px var(--sans);
  color: var(--ink-dim);
  cursor: pointer;
  user-select: none;
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

.custom-dropdown__option:hover,
.custom-dropdown__option.is-focused {
  background-color: var(--surface-3);
  color: var(--ink);
}

.custom-dropdown__option.is-selected {
  background-color: var(--signal-bg);
  color: var(--signal);
  font-weight: 600;
}

.custom-dropdown__option-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-dropdown__check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  color: var(--signal);
  opacity: 0;
  transform: scale(0.6);
  flex-shrink: 0;
  transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}

.custom-dropdown__option.is-selected .custom-dropdown__check {
  opacity: 1;
  transform: scale(1);
}

/* Universe picker specific override */
.custom-dropdown--universe .custom-dropdown__trigger {
  background: transparent;
  border: none;
  border-radius: var(--r-pill);
  box-shadow: none;
  padding: 4px 6px;
  font: 500 11.5px var(--mono);
  color: var(--ink);
}

.custom-dropdown--universe .custom-dropdown__trigger:hover {
  background: var(--surface-3);
}

.custom-dropdown--universe .custom-dropdown__trigger:focus,
.custom-dropdown--universe .custom-dropdown__trigger:focus-visible,
.custom-dropdown--universe.is-open .custom-dropdown__trigger {
  outline: none;
  border-color: transparent;
  box-shadow: none;
}

.custom-dropdown--universe .custom-dropdown__option {
  font-family: var(--mono);
  font-size: 11.5px;
}


/* ---------- search & ask box ---------- */

.search-box {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  background: var(--surface);
  border: var(--bd-strong);
  border-radius: var(--r-pill);
  padding: 6px 12px;
  box-shadow: var(--e-1);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.search-box:focus-within {
  border-color: var(--signal);
  box-shadow: var(--shadow-focus);
}
.search-icon {
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 1.75px solid var(--muted);
  border-radius: var(--r-full);
  position: relative;
  flex-shrink: 0;
  margin-left: 2px;
}
.search-icon::after {
  content: "";
  position: absolute;
  top: 9px;
  left: 9px;
  width: 5px;
  height: 1.75px;
  background: var(--muted);
  transform: rotate(45deg);
}
.search-box input {
  border: none;
  background: transparent;
  outline: none;
  border-color: transparent;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink);
  width: 100%;
}
.search-box input::placeholder {
  color: var(--faint);
}

.ask {
  display: flex;
  gap: var(--s-3);
  margin: var(--s-1) 0 var(--s-2);
}
.ask input {
  flex: 1;
  height: 46px;
  padding: 0 var(--s-4);
  font-size: 14px;
  border-radius: var(--r-pill);
  min-width: 0;
}
.ask input:focus {
  outline: none;
  border-color: var(--signal);
  box-shadow: var(--shadow-focus);
}
.ask .btn {
  height: 46px;
  border-radius: var(--r-pill);
}

.suggestions,
.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: var(--s-3);
}
.suggestions a,
.mono-pill {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-dim);
  padding: 4px 10px;
  border: var(--bd);
  border-radius: var(--r-pill);
  background: var(--surface);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  transition: border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.suggestions a:hover,
.mono-pill:hover {
  border-color: var(--signal);
  color: var(--ink);
  background: var(--surface-3);
  text-decoration: none;
}

/* ---------- filter bar ---------- */

form.filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
  align-items: flex-end;
  background: var(--surface);
  border: var(--bd);
  border-radius: var(--r-book-card);
  padding: var(--s-4) var(--s-5);
  margin-bottom: var(--s-4);
  box-shadow: var(--e-1);
}
.filter-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 130px;
  flex: 1 1 auto;
}
.filter-field select {
  width: 100%;
  min-width: 0;
}
form.filters label {
  font: 650 10.5px/1.2 var(--sans);
  letter-spacing: .11em;
  text-transform: uppercase;
  color: var(--muted);
}
.filter-actions {
  display: flex;
  gap: var(--s-2);
  align-items: center;
}
@media (max-width: 719px) {
  form.filters {
    padding: var(--s-4);
    gap: var(--s-3);
    flex-direction: column;
    align-items: stretch;
  }
  .filter-field {
    flex: 1 1 100%;
    min-width: 100%;
  }
  .filter-actions {
    width: 100%;
    margin-top: var(--s-2);
  }
  .filter-actions .btn {
    flex: 1;
    text-align: center;
    justify-content: center;
  }
}

/* ---------- tables ---------- */

.tablewrap {
  border: var(--bd);
  border-radius: var(--r-book-card);
  background: var(--surface);
  box-shadow: var(--e-1);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: var(--s-4) 0;
  width: 100%;
  max-width: 100%;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  line-height: 1.45;
}
@media (max-width: 719px) {
  table {
    min-width: 580px;
  }
}
caption {
  text-align: left;
}

thead th {
  position: static;
  text-align: left;
  white-space: nowrap;
  font: 650 10.5px/1.2 var(--sans);
  letter-spacing: .11em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface-2);
  padding: 11px 16px;
  border-bottom: var(--bd);
}
tbody td {
  padding: 11px 16px;
  border-bottom: var(--bd-soft);
  color: var(--ink);
}
tbody tr:last-child td {
  border-bottom: 0;
}
tbody tr:hover td {
  background: var(--surface-3);
}
td.num, th.num {
  text-align: right;
}
td.dim, .fig.dim {
  color: var(--muted);
}
.pos {
  color: var(--pos);
}
.neg {
  color: var(--neg);
}

.identity {
  min-width: 220px;
}
.identity a {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--math-blue);
  font-weight: 500;
}
.identity a:hover {
  color: var(--signal);
}
.ticker {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 11.5px;
}

/* ---------- stat tiles ---------- */

.statbar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1px;
  background: var(--line);
  border: var(--bd);
  border-radius: var(--r-book-card);
  box-shadow: var(--e-1);
  overflow: hidden;
  margin-bottom: var(--s-6);
  width: 100%;
}
@media (max-width: 719px) {
  .statbar {
    grid-template-columns: repeat(2, 1fr);
  }
  .stat {
    padding: 12px 14px;
  }
  .stat-n {
    font-size: 20px;
  }
}
.stat {
  background: var(--surface);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
}
.stat-n {
  font-size: 28px;
  font-weight: 650;
  line-height: 1.15;
  letter-spacing: -.02em;
  color: var(--ink);
  font-family: var(--mono);
}
.stat-l {
  color: var(--muted);
  font: 650 10.5px/1.2 var(--sans);
  letter-spacing: .11em;
  text-transform: uppercase;
  margin-top: 6px;
}
.stat-x {
  color: var(--faint);
  font-size: 11.5px;
  margin-top: 4px;
  font-family: var(--mono);
}
.stat-x a {
  color: var(--signal);
  text-decoration: none;
}
.stat-x a:hover {
  text-decoration: underline;
}

/* ---------- module cards & widget card ---------- */

.module-card {
  background: var(--surface);
  border: var(--bd);
  border-radius: var(--r-book-card);
  padding: var(--s-6);
  display: flex;
  flex-direction: column;
  box-shadow: var(--e-1);
  transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.module-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--e-2);
}
.module-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--s-3);
}
.card-meta {
  display: flex;
  align-items: center;
  gap: var(--s-2);
}

.hero-widget-card {
  background: var(--surface);
  border: var(--bd);
  border-radius: var(--r-book-card);
  box-shadow: var(--e-1);
  overflow: hidden;
}
.widget-header {
  padding: var(--s-4) var(--s-5);
  border-bottom: var(--bd);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-2);
}
.widget-header__title {
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.widget-heading {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.widget-body {
  padding: var(--s-5);
}
.live-dot {
  width: 7px;
  height: 7px;
  border-radius: var(--r-full);
  background: var(--pos);
  box-shadow: 0 0 0 3px var(--pos-bg);
  display: inline-block;
}
.metrics-row {
  display: grid;
  gap: var(--s-4);
}
.metric-item {
  display: flex;
  flex-direction: column;
}
.metric-label {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin-bottom: 2px;
  text-transform: uppercase;
}
.metric-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  font-family: var(--mono);
}
.card-action-link {
  font-size: 12px;
  font-weight: 500;
  color: var(--signal);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.card-action-link:hover {
  color: var(--math-blue);
  text-decoration: underline;
}

/* ---------- badges ---------- */

.badge {
  display: inline-block;
  padding: 3px 9px;
  border: 1px solid;
  border-radius: var(--r-sm);
  font: 650 10.5px var(--mono);
  letter-spacing: .1em;
  white-space: nowrap;
}
.badge-ok      { color: var(--ok);      border-color: var(--ok);      background: var(--pos-bg); }
.badge-bad     { color: var(--bad);     border-color: var(--bad);     background: var(--bad-bg); }
.badge-warn    { color: var(--warn);    border-color: var(--warn);    background: var(--warn-bg); }
.badge-info    { color: var(--info);    border-color: var(--info);    background: var(--signal-bg); }
.badge-neutral { color: var(--neutral); border-color: var(--line-strong); background: none; }

.mono-badge {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.72px;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: var(--r-badge);
  background: var(--surface-2);
  border: var(--bd);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
}
.mono-badge--blue {
  background: var(--signal-bg);
  border-color: var(--signal);
  color: var(--signal);
}
.mono-badge--pos {
  background: var(--pos-bg);
  border-color: var(--pos);
  color: var(--pos);
}
.mono-badge--neg {
  background: var(--neg-bg);
  border-color: var(--neg);
  color: var(--neg);
}

/* ---------- notes and callouts ---------- */

.note {
  background: var(--surface);
  border: var(--bd);
  border-left: 4px solid var(--signal);
  border-radius: var(--r-book-card);
  padding: 14px 18px;
  font-size: 13px;
  line-height: 1.5;
  margin: var(--s-4) 0;
  color: var(--ink-dim);
  box-shadow: var(--e-1);
}
.note strong {
  color: var(--ink);
}
.note-warn {
  border-left-color: var(--warn);
  background: var(--warn-bg);
}
.note-alert {
  border-left-color: var(--bad);
  background: var(--bad-bg);
}

/* ---------- panels ---------- */

.lane {
  border: var(--bd);
  border-radius: var(--r-book-card);
  background: var(--surface);
  box-shadow: var(--e-1);
  margin-bottom: var(--s-6);
  overflow: hidden;
}
.lane > h3 {
  margin: 0;
  padding: 13px 18px;
  background: var(--surface-2);
  border-bottom: var(--bd);
  font: 650 11px/1.2 var(--sans);
  letter-spacing: .13em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  flex-wrap: wrap;
  color: var(--ink);
}
.lane > h3 .who {
  color: var(--muted);
  letter-spacing: .01em;
  text-transform: none;
  font-weight: 400;
  font-size: 11.5px;
}
.lane .body {
  padding: var(--s-5);
}

.kv {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 9px 16px;
  font-size: 13px;
}
.kv .k {
  color: var(--muted);
}
.kv .v {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
  color: var(--ink);
}

/* ---------- empty states ---------- */

.empty {
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-book-card);
  padding: 44px 24px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  background: var(--surface);
}
.empty-msg {
  color: var(--ink-dim);
}
.empty-hint {
  color: var(--faint);
  margin-top: var(--s-2);
  font-size: 12px;
}
.empty code {
  color: var(--ink-dim);
  font-family: var(--mono);
}

/* ---------- breadcrumb ---------- */

.breadcrumb {
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: var(--s-2);
}
.breadcrumb span[aria-current] {
  color: var(--ink-dim);
}

/* ---------- provenance ---------- */

.source-bar {
  display: flex;
  gap: var(--s-4);
  align-items: baseline;
  flex-wrap: wrap;
  background: var(--surface);
  border-left: 3px solid var(--signal);
  padding: var(--s-4) var(--s-6);
  margin: 0;
  font-size: 12.5px;
  border-bottom: var(--bd-soft);
}
.source-bar:last-child {
  border-bottom: 0;
}
.source-bar-label {
  font: 650 9.5px/1.2 var(--mono);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--signal);
  white-space: nowrap;
}
.source-bar-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.source-bar-counts {
  color: var(--ink-dim);
}
.source-bar-meta {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11.5px;
}
.source-bar-docs {
  overflow-wrap: anywhere;
}

.source-doc {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--math-blue);
}
.source-doc:hover {
  color: var(--signal);
}
.row-provenance {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  flex-wrap: wrap;
}

details.evidence {
  display: inline-block;
}
details.evidence > summary {
  cursor: pointer;
  color: var(--muted);
  font: 10.5px var(--mono);
  text-transform: uppercase;
  letter-spacing: .12em;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 9px;
  border: var(--bd);
  border-radius: var(--r-sm);
  background: var(--surface);
  user-select: none;
  transition: all var(--dur-fast) var(--ease);
}
details.evidence > summary::-webkit-details-marker {
  display: none;
}
.evidence-caret::before {
  content: "\25B8";
  color: var(--signal);
  font-size: 9px;
}
details.evidence[open] .evidence-caret::before {
  content: "\25BE";
}
details.evidence > summary:hover {
  color: var(--ink);
  border-color: var(--signal);
}

.chain {
  display: grid;
  grid-template-columns: 132px 1fr;
  gap: 0;
  margin: var(--s-3) 0 0;
  font-size: 12.5px;
  background: var(--surface);
  border: var(--bd);
  border-radius: var(--r);
  overflow: hidden;
}
.chain dt {
  color: var(--muted);
  padding: 8px 14px;
  font: 650 10.5px/1.4 var(--sans);
  letter-spacing: .09em;
  text-transform: uppercase;
  border-bottom: var(--bd-soft);
  background: var(--surface-2);
}
.chain dd {
  margin: 0;
  padding: 8px 14px;
  font-family: var(--mono);
  overflow-wrap: anywhere;
  border-bottom: var(--bd-soft);
  color: var(--ink);
}
.chain dt:last-of-type, .chain dd:last-of-type {
  border-bottom: 0;
}
.chain .step {
  display: inline-block;
  min-width: 15px;
  color: var(--signal);
  font-family: var(--mono);
}
.chain .native {
  color: var(--interp);
}
.chain .dim {
  color: var(--faint);
}

/* ---------- claim bands ---------- */

.answer {
  border: var(--bd-strong);
  border-radius: var(--r-book-card);
  background: var(--surface);
  box-shadow: var(--e-2);
  overflow: hidden;
  margin-bottom: var(--s-6);
}
.stack {
  display: flex;
  flex-direction: column;
  padding: 0;
}

.claim {
  border-left: 3px solid var(--line);
  padding: var(--s-5) var(--s-6);
  border-bottom: var(--bd-soft);
}
.claim:last-child {
  border-bottom: 0;
}
.claim-kind {
  display: inline-block;
  text-transform: uppercase;
  letter-spacing: .16em;
  font: 650 9.5px/1.2 var(--mono);
  margin-bottom: var(--s-2);
}
.claim-rule {
  color: var(--muted);
  font-size: 11.5px;
  margin-left: var(--s-2);
}
.claim-text {
  font-size: 14.5px;
  color: var(--ink);
  line-height: 1.45;
}
.claim-src {
  color: var(--muted);
  font-size: 11px;
  margin-top: 7px;
  font-family: var(--mono);
}
.claim-src code {
  color: var(--ink-dim);
}

/* DATA is never tinted. */
.claim-data {
  border-left-color: var(--fact);
}
.claim-data .claim-kind {
  color: var(--fact);
}

.claim-signal {
  border-left-color: var(--signal);
  background: var(--signal-bg);
}
.claim-signal .claim-kind {
  color: var(--signal);
}
.claim-signal .claim-text {
  font-size: 15px;
  font-weight: 600;
}

.claim-interpretation {
  border-left-color: var(--interp);
  background: var(--interp-bg);
}
.claim-interpretation .claim-kind {
  color: var(--interp);
}
.claim-interpretation .claim-text {
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
}

.factbox {
  border: var(--bd-soft);
  border-radius: var(--r-md);
  margin: var(--s-2) 0 var(--s-1);
  overflow: hidden;
  background: var(--surface-2);
}
.factbox thead th {
  position: static;
  background: var(--surface-3);
}

/* ---------- verdict block ---------- */

.verdict {
  padding: var(--s-6);
  background: var(--surface);
  border: none;
  border-bottom: var(--bd-soft);
  border-radius: 0;
  box-shadow: none;
  margin-bottom: 0;
}
.verdict-head {
  display: flex;
  align-items: baseline;
  gap: var(--s-3);
  flex-wrap: wrap;
}
.verdict-subject {
  font-size: 30px;
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.9px;
  color: var(--ink);
}
.verdict-isin {
  color: var(--faint);
  font-size: 12px;
}
.verdict-meta {
  color: var(--muted);
  font-size: 11.5px;
  margin-top: var(--s-3);
}

.verdict-readings {
  display: flex;
  gap: var(--s-8);
  flex-wrap: wrap;
  align-items: flex-start;
  margin-top: var(--s-4);
}
.verdict-readings > * + * {
  border-left: var(--bd);
  padding-left: var(--s-8);
}
@media (max-width: 719px) {
  .verdict {
    padding: var(--s-4);
  }
  .claim,
  .source-bar {
    padding: var(--s-4);
  }
  .verdict-subject {
    font-size: 22px;
  }
  .verdict-readings {
    flex-direction: column;
    gap: var(--s-4);
  }
  .verdict-readings > * + * {
    border-left: 0;
    padding-left: 0;
    border-top: var(--bd-soft);
    padding-top: var(--s-4);
    width: 100%;
  }
}
.magnitude .fig {
  display: block;
  font-size: 30px;
  font-weight: 650;
  line-height: 1.12;
  letter-spacing: -.022em;
}
.verdict-headline {
  display: block;
  font-size: 20px;
  font-weight: 650;
  color: var(--ink);
}
.magnitude-label, .breadth-label {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font: 650 10.5px/1.3 var(--sans);
  letter-spacing: .11em;
  text-transform: uppercase;
}
.breadth .fig {
  font-size: 30px;
  font-weight: 650;
  line-height: 1.12;
  letter-spacing: -.022em;
}
.breadth-dots {
  display: inline-flex;
  gap: 4px;
  margin-right: var(--s-2);
  vertical-align: middle;
}
.breadth-dots i {
  width: 7px;
  height: 7px;
  border-radius: var(--r-pill);
  background: var(--line-strong);
  display: inline-block;
}
.breadth-dots i.on {
  background: var(--signal);
}

/* ---------- verdict lanes ---------- */

.verdict-lane {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1px;
  background: var(--line);
  border: var(--bd);
  border-radius: var(--r-book-card);
  box-shadow: var(--e-1);
  overflow: hidden;
  margin: var(--s-1) 0 var(--s-4);
}
.verdict-cell {
  background: var(--surface);
  padding: 14px 16px;
}
.verdict-party {
  color: var(--muted);
  font: 650 10.5px/1.3 var(--sans);
  letter-spacing: .11em;
  text-transform: uppercase;
  margin-bottom: var(--s-2);
}
.verdict-basis {
  color: var(--faint);
  font-size: 11.5px;
  margin-top: var(--s-2);
}

/* ---------- discovery & analysis ---------- */

.analysis-container {
  margin-top: var(--s-3);
  padding: var(--s-3);
  background: var(--surface-3);
  border-radius: var(--r-sm);
  font-size: 12px;
  max-width: 100%;
  overflow: hidden;
  word-break: break-word;
}
.disclosure-links-list {
  margin: 0 0 var(--s-2) var(--s-4);
  padding: 0;
  list-style: disc;
  max-width: 100%;
  overflow: hidden;
}
.disclosure-links-list li {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 4px;
}
.disclosure-link {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
  word-break: break-all;
}

/* ---------- pipeline control form ---------- */

.pipeline-form-row {
  display: flex;
  gap: var(--s-4);
  flex-wrap: wrap;
  align-items: flex-end;
}
.pipeline-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pipeline-label {
  display: block;
  font: 500 12px/1.3 var(--sans);
  color: var(--ink-dim);
  margin: 0;
}
.pipeline-input-num {
  width: 140px;
  min-width: 140px;
  height: 38px;
  box-sizing: border-box;
  border-radius: var(--r-md);
}
.pipeline-action {
  display: flex;
  align-items: flex-end;
}
.pipeline-btn-start {
  height: 38px;
  box-sizing: border-box;
  padding: 0 20px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--r-md);
  box-shadow: var(--e-1);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ---------- discovery terminal & live telemetry console ---------- */

.discovery-terminal {
  display: none;
  margin-top: var(--s-4);
  background: var(--surface-3);
  border: var(--bd-strong);
  border-radius: var(--r-md);
  box-shadow: var(--e-1);
  overflow: hidden;
}
.discovery-terminal__header {
  background: var(--surface-2);
  border-bottom: var(--bd);
  padding: 8px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}
.discovery-terminal__title {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-weight: 600;
  color: var(--ink);
}
.discovery-terminal__actions {
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.discovery-terminal__body {
  padding: var(--s-3);
  max-height: 280px;
  overflow-y: auto;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.55;
  background: var(--surface-3);
  color: var(--ink);
}
.discovery-terminal__footer {
  display: none;
  padding: var(--s-3);
  border-top: var(--bd);
  background: var(--surface);
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  flex-wrap: wrap;
}




