/* Муха-инвестор — «ночная лаборатория». Одна тема: тёмный стол под лампой. */
:root {
  --bench: #1F242A;
  --bench-deep: #181C21;
  --panel: #272D34;
  --line: #3A424C;
  --ink: #ECE7DC;
  --muted: #9CA5AE;
  --putty: #D6CBB2;
  --putty-shade: #B3A68A;
  --putty-ink: #3B3427;
  --glass: #16110B;
  --phosphor: #FFB547;
  --phosphor-dim: #A8762E;
  --eye: #E0453A;
  --sugar: #F2D59B;
  --bitter: #A9BE52;
  --mn9: #E0453A;
  --other: #7E8B97;
  --eat: #7CCB8A;
  --nibble: #E2A63B;
  --spit: #E0453A;

  --f-display: "Pixelify Sans", "Golos Text", system-ui, sans-serif;
  --f-body: "Golos Text", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "PT Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 72px;
  --t-xs: 12px; --t-sm: 14px; --t-md: 16px; --t-lg: 20px; --t-xl: 28px; --t-2xl: 40px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(900px 520px at 18% 0%, rgba(255, 214, 150, 0.07), transparent 70%),
    var(--bench);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: var(--t-md);
  line-height: 1.55;
  padding-inline: 16px;
  padding-block: var(--s-5) var(--s-8);
}

.page {
  max-width: 1480px; margin-inline: auto; display: grid; gap: var(--s-6) var(--s-7);
  grid-template-columns: minmax(0, 1fr) 320px;
  grid-template-areas: "head head" "main side";
  align-items: start;
}
.masthead { grid-area: head; }
/* Статическая сводка страницы публичной сборки (site_pages.py): её видят поисковики и медленная загрузка; живой вид
   скрыт за ней, пока app.js не уберёт её после загрузки данных. */
.seo-page { max-width: 760px; margin-inline: auto; overflow-wrap: anywhere; }
.seo-page ~ .page { display: none; }
.seo-page h1 { margin: var(--s-2) 0 var(--s-3); font: 700 var(--t-2xl)/1.1 var(--f-display); }
.seo-page h2 { margin: var(--s-5) 0 var(--s-2); font: 600 var(--t-lg)/1.3 var(--f-body); }
.seo-page p, .seo-page ul { margin: 0 0 var(--s-3); }
.seo-page ul { padding-left: var(--s-5); }
.seo-page-site, .seo-page-kind, .seo-page-note { color: var(--muted); font-size: var(--t-sm); }
.seo-page-verdict { font-family: var(--f-mono); color: var(--phosphor); }
.main {
  grid-area: main; display: grid; gap: var(--s-7); min-width: 0;
  /* minmax(0,1fr): колонка не должна зависеть от внутренней ширины canvas —
     иначе сцена раздувает трек, а трек — canvas (петля роста) */
  grid-template-columns: minmax(0, 1fr);
}
.main > .lab { margin-bottom: calc(var(--s-7) * -1 + var(--s-4)); }   /* досье начинается сразу под сценой */

/* ---------- боковая панель ---------- */
.side {
  grid-area: side; position: sticky; top: var(--s-4); display: grid; gap: var(--s-4);
  height: calc(100dvh - 32px); min-height: 0; min-width: 0; overflow: hidden;
  grid-template-rows: auto auto minmax(0, 1fr) auto; scroll-margin-top: 16px;
}
.side > [hidden] { display: none; }
.research-search { width: 100%; min-width: 0; padding: 11px 12px; border: 1px solid var(--line); border-radius: 4px; color: var(--ink); background: var(--panel); font: var(--t-sm)/1.3 var(--f-body); }
.research-search::placeholder { color: var(--muted); }
.side-status { border-top: 1px solid var(--line); padding-top: 10px; font-size: 11px; line-height: 1.5; color: var(--muted); }
.side-status a { display: inline-block; margin-top: 6px; color: var(--phosphor); }
.side-head { display: flex; align-items: baseline; justify-content: space-between; border-top: 1px solid var(--line); padding-top: var(--s-3); }
.side-head h2 { font: 700 var(--t-lg)/1 var(--f-display); }
.side-count { font: var(--t-xs)/1 var(--f-mono); color: var(--muted); }
.runs { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; overflow-y: auto; min-height: 0; align-content: start; scrollbar-width: thin; scrollbar-color: var(--muted) transparent; overscroll-behavior-y: contain; scrollbar-gutter: stable; }
.run {
  width: 100%; text-align: left; background: var(--panel); color: var(--ink); border: 0; border-left: 3px solid transparent;
  padding: 10px 12px; cursor: pointer; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; font: inherit; text-decoration: none;
}
.runs > li { min-width: 0; }
.run:focus-visible, .runs:focus-visible, .research-search:focus-visible { outline: 2px solid var(--phosphor); outline-offset: -2px; }
.run:hover { background: #2E353D; }
.run[aria-current="true"] { background: #333B44; border-left-color: var(--phosphor); }
.run-name { font-weight: 500; font-size: var(--t-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.run-meta { grid-column: 1 / -1; display: flex; justify-content: space-between; gap: var(--s-2); font: var(--t-xs)/1.3 var(--f-mono); color: var(--muted); }
.run-meta span { min-width: 0; }
.run-meta span:last-child { flex-shrink: 0; }
.run-meta span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.run .pill { align-self: center; }
.pill[data-d="RUN"], .pill[data-d="QUEUE"] { color: var(--phosphor); }
.pill[data-d="ERR"] { color: var(--muted); }
.run-progress { grid-column: 1 / -1; height: 3px; background: var(--line); position: relative; overflow: hidden; }
.run-progress i { position: absolute; inset: 0 auto 0 0; background: var(--phosphor); transition: width 400ms ease; }
.run-progress.indet i { width: 30%; animation: indet 1.4s ease-in-out infinite; }
@keyframes indet { 0% { left: -30%; } 100% { left: 100%; } }
.runs-empty { color: var(--muted); font-size: var(--t-sm); padding: var(--s-3) 0; }
.active-deals { display: grid; gap: 8px; min-width: 0; max-width: 100%; }
.active-deals[hidden] { display: none; }
.active-head { border-top: 0; padding-top: 0; }
.active-deals-note { font-size: 10px; color: var(--muted); line-height: 1.4; overflow-wrap: anywhere; }
.active-deals-list { list-style: none; margin: 0; padding: 1px 1px 8px; display: flex; gap: 10px; min-width: 0; max-width: 100%; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; scrollbar-color: var(--muted) transparent; overscroll-behavior-x: contain; scroll-snap-type: x proximity; scroll-padding-inline: 1px; }
.active-deals-list > li { flex: 1 0 220px; display: grid; grid-template-rows: 1fr auto; min-width: 0; max-width: 360px; scroll-snap-align: start; }
.active-deal-open { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-content: start; gap: 4px 8px; width: 100%; height: 100%; padding: 10px 11px; border: 1px solid var(--line); border-left: 3px solid var(--phosphor-dim); border-radius: 5px; background: var(--panel); color: var(--ink); text-align: left; font: inherit; }
button.active-deal-open, a.active-deal-open { cursor: pointer; text-decoration: none; }
button.active-deal-open:hover, a.active-deal-open:hover, .active-deal-open[aria-current="true"] { background: #333B44; border-left-color: var(--phosphor); }
.active-deal-title { font-size: 13px; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.active-deal-open .pill { align-self: start; }
.active-deal-meta, .active-deal-timing, .active-deal-research, .active-deal-source { grid-column: 1 / -1; font-size: 11px; line-height: 1.35; }
.active-deal-meta { color: var(--muted); }
.active-deal-timing { color: var(--sugar); font-family: var(--f-mono); }
.active-deal-research { color: var(--muted); }
.active-deal-referred { border-bottom: 0; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.active-deal-source { display: block; padding: 8px 11px; border: 1px solid var(--line); border-top: 0; border-left: 3px solid var(--phosphor-dim); border-radius: 0 0 5px 5px; background: var(--panel); color: var(--phosphor); text-decoration: underline; text-underline-offset: 3px; }
.active-deal-source:hover { background: #333B44; }
.active-deals-empty { padding: 4px 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.active-deals-list:focus-visible, .active-deal-open:focus-visible, .active-deal-source:focus-visible { outline: 2px solid var(--phosphor); outline-offset: -2px; }
.terminal .prog { color: var(--phosphor-dim); }

h1, h2, h3 { text-wrap: balance; margin: 0; }
p { margin: 0; }
a { color: var(--sugar); text-underline-offset: 2px; }
a:hover { color: var(--ink); }
:focus-visible { outline: 2px solid var(--phosphor); outline-offset: 2px; }

/* ---------- шапка ---------- */
.masthead { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: var(--s-4); }
.language-switch { display: inline-flex; align-self: start; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 5px; background: var(--panel); }
.language-switch button { min-width: 44px; min-height: 40px; padding: 7px 11px; border: 0; border-radius: 3px; background: transparent; color: var(--muted); cursor: pointer; font: 600 var(--t-sm)/1 var(--f-body); }
.language-switch button[aria-pressed="true"] { background: var(--putty); color: var(--putty-ink); }
.language-switch button:focus-visible { outline: 2px solid var(--phosphor); outline-offset: 2px; }
.translation-note { flex-basis: 100%; margin: 0; color: var(--muted); font-size: var(--t-xs); }
.translation-note[hidden] { display: none; }
.brand-name {
  font-family: var(--f-display); font-weight: 700; font-size: var(--t-2xl); line-height: 1;
  letter-spacing: 0.01em;
}
.brand-name::after { content: ""; display: inline-block; width: 0.32em; height: 0.32em; margin-left: 0.18em; background: var(--eye); vertical-align: 0.55em; }
.brand-sub { color: var(--muted); font-size: var(--t-sm); margin-top: var(--s-2); }
.tabs { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.tab {
  font: 500 var(--t-sm)/1 var(--f-body); color: var(--ink); background: transparent;
  border: 1px solid var(--line); padding: 9px 14px; cursor: pointer; display: inline-flex; gap: var(--s-2); align-items: center;
}
.tab[aria-selected="true"] { background: var(--putty); color: var(--putty-ink); border-color: var(--putty); }
.tab .dot { width: 8px; height: 8px; background: var(--muted); }
.tab .dot[data-d="EAT"] { background: var(--eat); }
.tab .dot[data-d="NIBBLE"] { background: var(--nibble); }
.tab .dot[data-d="SPIT"] { background: var(--spit); }

/* ---------- сцена ---------- */

/* ---------- компьютер ---------- */
.computer { display: grid; justify-items: center; }
.crt {
  width: 100%; background: linear-gradient(180deg, #DDD3BC, var(--putty) 30%, #C9BDA2);
  padding: 22px 22px 0; border-radius: 18px 18px 8px 8px;
  box-shadow: inset 0 -6px 0 var(--putty-shade), 0 18px 40px rgba(0, 0, 0, 0.35);
}
.crt-glass {
  position: relative; background: var(--glass); border-radius: 14px / 18px;
  padding: var(--s-3) var(--s-4) var(--s-4);
  box-shadow: inset 0 0 0 3px #8F846C, inset 0 0 40px rgba(0, 0, 0, 0.9);
  overflow: hidden; display: grid; gap: var(--s-2);
}
.crt-glass::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(180deg, rgba(0, 0, 0, 0.22) 0 1px, transparent 1px 3px),
              radial-gradient(120% 90% at 50% 40%, rgba(255, 181, 71, 0.06), transparent 60%);
}
.crt-bar { display: flex; justify-content: space-between; font: var(--t-xs)/1 var(--f-mono); color: var(--phosphor-dim); letter-spacing: 0.06em; }
.terminal {
  height: 300px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--phosphor-dim) transparent;
  font: var(--t-sm)/1.45 var(--f-mono); color: var(--phosphor);
  text-shadow: 0 0 6px rgba(255, 181, 71, 0.45);
}
.terminal .ln { white-space: pre-wrap; overflow-wrap: anywhere; }
.terminal .dim { color: var(--phosphor-dim); }
.terminal .cmd::before { content: "$ "; color: var(--phosphor-dim); }
.terminal .plus { color: #FFE0A3; }
.terminal .minus { color: #C9A05A; }
.terminal .big { font-weight: 700; letter-spacing: 0.04em; }
.terminal .cursor::after { content: "▌"; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.crt-raster { width: 100%; height: 72px; display: block; image-rendering: pixelated; opacity: 0.95; }
.crt-chin { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-3) 4px var(--s-3); }
.crt-brand { font: 500 var(--t-xs)/1 var(--f-display); color: #7D715A; letter-spacing: 0.12em; }
.key {
  font: 500 var(--t-sm)/1 var(--f-body); color: var(--putty-ink); background: #E7DEC9;
  border: 1px solid #9C9077; border-bottom-width: 4px; padding: 9px 14px; cursor: pointer;
}
.key:active { border-bottom-width: 1px; transform: translateY(3px); }
.crt-keys { display: flex; flex-wrap: wrap; gap: var(--s-2); justify-content: center; }
.key-link { text-decoration: none; display: inline-flex; align-items: center; }
.key-link.pulse { box-shadow: 0 0 0 2px var(--phosphor); }
.brain-view { min-height: 240px; }
.key[disabled] { opacity: 0.6; cursor: progress; }
.crt-led { width: 10px; height: 10px; border-radius: 50%; background: #5B6B3A; box-shadow: inset 0 0 0 1px rgba(0,0,0,.3); }
.crt-led.on { background: #9BE36B; box-shadow: 0 0 8px #9BE36B; }
.crt-stand { width: 34%; height: 22px; background: linear-gradient(180deg, #B9AD92, #9E9278); clip-path: polygon(12% 0, 88% 0, 100% 100%, 0 100%); }

/* ---------- лаборатория: муха за компьютером ---------- */
.lab { display: grid; gap: var(--s-4); min-width: 0; }
.lab-stage { position: relative; min-width: 0; background: var(--bench-deep); border: 1px solid var(--line); }
#lab-canvas {
  display: block; width: 100%; max-width: 100%; height: auto; aspect-ratio: 192 / 96;
  image-rendering: pixelated; image-rendering: crisp-edges;
}
.fly-bubble {
  position: absolute; left: 3%; top: 4%;
  font: 700 clamp(16px, 1.9vw, 24px)/1.1 var(--f-display); color: var(--putty-ink); background: var(--putty);
  padding: 7px 12px 9px; white-space: nowrap; box-shadow: 4px 4px 0 var(--bench-deep);
  transition: opacity 180ms ease, transform 180ms ease;
}
.fly-bubble:empty { opacity: 0; transform: translateY(4px); }
.fly-bubble::after { content: ""; position: absolute; left: 14px; bottom: -8px; border: 8px solid transparent; border-top-color: var(--putty); border-bottom: 0; }
.lab-bar { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--s-4); align-items: start; }
.lab-keys { display: flex; align-items: center; gap: var(--s-3); }
.logbook { background: var(--panel); min-width: 0; }
.logbook > summary {
  cursor: pointer; padding: 10px 12px; font: 500 var(--t-xs)/1 var(--f-mono); text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--muted); list-style: none;
}
.logbook > summary::-webkit-details-marker { display: none; }
.logbook > summary::before { content: "▸ "; }
.logbook[open] > summary::before { content: "▾ "; }
.logbook .crt-glass { border-radius: 0; margin: 0 8px 8px; }
.logbook .terminal { height: 240px; }
.pending-note {
  border: 1px dashed var(--line); padding: var(--s-4); color: var(--muted); font-size: var(--t-sm);
  font-family: var(--f-mono); text-align: center;
}
.pending-note[hidden], .results[hidden] { display: none; }

/* ---------- бумажное досье (пиксельный документ) ---------- */
.paper {
  position: relative; background: var(--putty); color: var(--putty-ink);
  padding: var(--s-5) var(--s-5) var(--s-6) 44px;
  display: grid; gap: var(--s-4);
  /* пиксельные срезанные углы + «пиксельная» тень */
  clip-path: polygon(8px 0, calc(100% - 8px) 0, calc(100% - 8px) 4px, calc(100% - 4px) 4px,
    calc(100% - 4px) 8px, 100% 8px, 100% calc(100% - 8px), calc(100% - 4px) calc(100% - 8px),
    calc(100% - 4px) calc(100% - 4px), calc(100% - 8px) calc(100% - 4px), calc(100% - 8px) 100%,
    8px 100%, 8px calc(100% - 4px), 4px calc(100% - 4px), 4px calc(100% - 8px), 0 calc(100% - 8px),
    0 8px, 4px 8px, 4px 4px, 8px 4px);
  filter: drop-shadow(6px 6px 0 var(--bench-deep));
}
.paper::before {                        /* полоска-корешок слева */
  content: ""; position: absolute; left: 26px; top: 0; bottom: 0; width: 2px;
  background: repeating-linear-gradient(180deg, rgba(59,52,39,.35) 0 6px, transparent 6px 12px);
}
.paper-punch { position: absolute; left: 10px; top: 0; bottom: 0; width: 12px; display: grid; align-content: space-evenly; }
.paper-punch::before, .paper-punch::after {
  content: ""; width: 12px; height: 12px; border-radius: 50%;
  background: var(--bench); box-shadow: inset 0 2px 0 rgba(0,0,0,.35);
}
.paper-head { display: flex; flex-wrap: wrap; gap: var(--s-4); align-items: flex-start; justify-content: space-between; }
.paper-kicker { font: 500 var(--t-xs)/1 var(--f-mono); text-transform: uppercase; letter-spacing: 0.16em; opacity: 0.65; }
.paper-title { font: 700 var(--t-2xl)/1 var(--f-display); margin-top: 6px; overflow-wrap: anywhere; }
.research-share { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 12px; font-size: var(--t-sm); }
.research-share-copy { border: 1px solid currentColor; padding: 7px 10px; color: inherit; background: transparent; font: inherit; cursor: pointer; }
.research-share-copy:hover { background: rgba(0, 0, 0, .06); }
.research-share a { color: inherit; overflow-wrap: anywhere; user-select: all; }
.research-share-status { flex-basis: 100%; font-size: var(--t-xs); }
.research-share-status:empty { display: none; }
.research-not-found { padding: 28px; border: 1px solid var(--line); background: var(--panel); display: grid; gap: 16px; line-height: 1.5; }
.research-share[hidden], .research-not-found[hidden], .lab[hidden] { display: none; }
.paper-meta { font: var(--t-xs)/1.5 var(--f-mono); opacity: 0.75; margin-top: 8px; }
.paper-offer { margin-top: 10px; font-size: var(--t-xs); }
.paper-offer a { color: inherit; text-underline-offset: 3px; }
.paper-rule { height: 2px; background: repeating-linear-gradient(90deg, rgba(59,52,39,.5) 0 4px, transparent 4px 8px); }

.stamp {
  font: 700 44px/1 var(--f-display); letter-spacing: 0.04em; padding: 8px 16px 12px;
  border: 4px solid currentColor; transform: rotate(-6deg); color: #7C7361; align-self: center;
}
.stamp[data-d="EAT"] { color: #2F7A46; }
.stamp[data-d="NIBBLE"] { color: #9A6B14; }
.stamp[data-d="SPIT"] { color: #B03127; }
.stamp.thump { animation: thump 420ms cubic-bezier(.3,1.6,.5,1); }
@keyframes thump { 0% { transform: rotate(-6deg) scale(1.5); opacity: 0; } 100% { transform: rotate(-6deg) scale(1); opacity: 1; } }

.paper-gauges { display: grid; gap: var(--s-3); }
.gauge {
  display: grid; grid-template-columns: 116px minmax(120px, 1fr) 84px; gap: 4px var(--s-3); align-items: center;
  font: var(--t-sm)/1.2 var(--f-mono);
}
.gauge-label { text-transform: uppercase; letter-spacing: 0.08em; }
.gauge-bar {
  height: 14px; background: rgba(59,52,39,.14); box-shadow: inset 0 0 0 2px rgba(59,52,39,.45);
  position: relative; overflow: hidden;
}
.gauge-bar i {
  position: absolute; inset: 2px auto 2px 2px; width: 0;
  background-image: repeating-linear-gradient(90deg, currentColor 0 6px, rgba(255,255,255,.25) 6px 8px);
  transition: width 800ms cubic-bezier(.2,.7,.2,1);
}
.gauge[data-kind="sugar"] i { color: #C79A3E; }
.gauge[data-kind="bitter"] i { color: #6F8430; }
.gauge[data-kind="mn9"] i { color: #B03127; }
.gauge-value { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.gauge-note { grid-column: 2 / -1; font-size: var(--t-xs); opacity: 0.7; }

.paper-verdict { font: var(--t-lg)/1.45 var(--f-body); max-width: 62ch; }
.paper-verdict b { font-family: var(--f-mono); font-weight: 700; }
.paper-baseline { font: var(--t-sm)/1.5 var(--f-body); max-width: 72ch; margin-top: 6px; }
.paper-baseline b { font-family: var(--f-mono); font-weight: 700; }
/* Evidence tier under the verdict (evidence_tier.py): the record behind it; a reference, never advice. */
.paper-evidence { margin-top: 10px; padding: 2px 0 2px 10px; border-left: 3px solid rgba(59,52,39,.45); overflow-wrap: anywhere; }
.paper-evidence[data-tier="proven"] { border-left-color: #2F6B3C; }
.paper-evidence[data-tier="no_record"] { border-left-style: dashed; }
/* The IPO / pre-IPO switch beside the dossier title; it wraps under the title on narrow screens. */
/* Switch and stamp stay together on the right; when the row is too narrow they wrap as one group. */
.paper-head-side { display: flex; flex-wrap: wrap; gap: var(--s-4); align-items: flex-start; justify-content: flex-end; margin-left: auto; max-width: 100%; }
.paper-switch { display: grid; gap: 6px; justify-items: end; margin-top: 6px; max-width: min(100%, 420px); }
.paper-switch[hidden] { display: none; }
.paper-switch .scenario-switch { justify-self: end; }
/* The title block yields width so the switch can sit level with the title, between it and the stamp. */
.paper-head > .paper-id { flex: 1 1 220px; min-width: 0; }
/* Kelly stake (kelly_sizing.py): a reference beside the verdict stamp, never the verdict. */
/* Wide enough for NIBBLE, the widest stamp, so the IPO / pre-IPO switch beside it stays put when the stamp word changes. */
.paper-verdict-head { display: grid; justify-items: center; gap: 10px; align-self: center; min-width: 212px; }   /* NIBBLE at 44px is 202px wide */
.kelly-chip { margin: 0; max-width: 24ch; padding: 4px 8px; border: 1px dashed currentColor; border-radius: 3px; font: 600 var(--t-xs)/1.3 var(--f-mono); text-align: center; color: var(--putty-ink); }
.kelly-chip[hidden], .paper-kelly[hidden] { display: none; }
.paper-kelly { display: grid; gap: 4px; }
.paper-kelly p { margin: 0; }
.paper-kelly .gmp-tag, .paper-kelly .paper-note { color: #574F41; opacity: 1; }
.paper-kelly details p { margin: 6px 0 0; }
.kelly-title { margin: 10px 0 2px; font: 700 var(--t-sm)/1.3 var(--f-body); }
.active-deal-kelly { grid-column: 1 / -1; font: 600 var(--t-xs)/1.2 var(--f-mono); opacity: .85; }   /* the cell beside it is always empty */
.active-deal-kelly .gmp-tag { opacity: .8; }   /* .85 × .8 of ink: at least 5:1 on the card and on the hovered card */
.scenario-switch { display: flex; flex-wrap: wrap; gap: 3px; padding: 3px; border: 1px solid rgba(59,52,39,.28); border-radius: 5px; justify-self: start; }
.scenario-switch button { min-width: 64px; min-height: 40px; padding: 7px 14px; border: 0; border-radius: 3px; background: transparent; color: var(--putty-ink); cursor: pointer; font: 600 var(--t-sm)/1.25 var(--f-body); text-align: center; }
.scenario-switch button[aria-pressed="true"] { background: var(--putty-ink); color: var(--putty); opacity: 1; }
.scenario-switch button:focus-visible, .scenario-switch a:focus-visible { outline: 2px solid var(--putty-ink); outline-offset: 2px; }
/* The other offer of an Ownit pair held by another research: a link that looks like the switch's other button. */
.scenario-switch a { display: inline-flex; align-items: center; justify-content: center; min-width: 64px; min-height: 40px; padding: 7px 14px; border-radius: 3px; color: var(--putty-ink); font: 600 var(--t-sm)/1.25 var(--f-body); text-decoration: none; }
.scenario-switch a:hover { background: rgba(59,52,39,.1); }
.scenario-groups { font: var(--t-xs)/1.5 var(--f-mono); }
/* The other horizon the reader picked: one note above the signals, which keep the deal's own rules. */
.paper-choice { display: grid; gap: 4px; max-width: 85ch; margin: 0 0 12px; padding: 8px 10px; border: 1px dashed rgba(59,52,39,.45); border-radius: 3px; font: var(--t-sm)/1.5 var(--f-body); }
.paper-choice[hidden] { display: none; }
.paper-choice p { margin: 0; }
.paper-choice b { font-family: var(--f-mono); font-weight: 700; }
/* The end of the dossier: the class statistic, the exchange-only run and how the sizing is computed. */
/* overflow-wrap: anywhere — a file path in a note (the class statistic names one) has no break point, and as a grid
   item of .paper its width would widen the whole dossier on a phone. */
.verdict-notes { margin-top: 22px; padding-top: 12px; border-top: 1px dashed rgba(59,52,39,.45); max-width: 85ch; overflow-wrap: anywhere; }
.verdict-notes[hidden] { display: none; }
.verdict-notes h3 { margin: 0 0 4px; font: 600 var(--t-md)/1.3 var(--f-body); }
.verdict-notes .paper-baseline { margin-top: 6px; }
/* How the verdict was reached: the verdict sentence, the history check, the taste formula and the caps, closed by default. */
/* min-width: 0 — a grid item of .paper: without it the caps table's own width widens the whole dossier on a phone.
   No overflow-wrap: anywhere here: the table would inherit it, shrink to the box and break its numbers mid-figure
   instead of scrolling inside .ipo-table-wrap. */
.verdict-details { margin-top: 22px; padding-top: 12px; border-top: 1px dashed rgba(59,52,39,.45); max-width: 85ch; min-width: 0; }
.verdict-details > summary { cursor: pointer; font: 600 var(--t-md)/1.3 var(--f-body); }
.verdict-details > .paper-verdict { margin-top: 10px; font-size: var(--t-md); max-width: 72ch; }
.verdict-details > .paper-note { margin-top: 10px; max-width: 85ch; }
/* Как менялась оценка (rating_timeline.py): справка, не прогноз. График на бумаге досье: те же чернила и цвета штампа. */
.rating-timeline { margin-top: 22px; padding-top: 12px; border-top: 1px dashed rgba(59,52,39,.45); max-width: 85ch; color: var(--putty-ink); }
.rating-timeline[hidden] { display: none; }
.rating-timeline h3 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; margin: 0 0 4px; font: 600 var(--t-md)/1.3 var(--f-body); }
.rating-timeline h3 small { font: 400 var(--t-xs)/1.3 var(--f-mono); color: #574F41; }
/* The chart stands under the gauges, where the verdict sentence stood; its texts are under spoilers. */
#brain-details .rating-timeline { margin-top: 20px; padding-top: 0; border-top: 0; }
#brain-details .paper-recompute { margin-top: 14px; }
.rating-timeline h4 { margin: 12px 0 2px; font: 700 var(--t-sm)/1.3 var(--f-body); }
.rating-timeline .paper-note { margin: 0 0 6px; color: #574F41; opacity: 1; }
.tl-figure { width: 100%; overflow: hidden; }
.tl-chart { display: block; width: 100%; height: auto; max-width: 760px; font: 11px/1 var(--f-mono); }
.tl-band[data-d="SPIT"] { fill: rgba(176,49,39,.08); }
.tl-band[data-d="NIBBLE"] { fill: rgba(154,107,20,.09); }
.tl-band[data-d="EAT"] { fill: rgba(47,122,70,.10); }
/* Under a NIBBLE verdict ceiling the band above the EAT threshold is NIBBLE too: a denser tint and a dashed threshold. */
.tl-band[data-capped] { fill: rgba(154,107,20,.16); }
.tl-ceiling { stroke: rgba(59,52,39,.5); stroke-width: 1; stroke-dasharray: 3 3; }
/* The band names are painted over the lines and under the points (app.js: timelineSvg moves a name a point would
   cover to a free place of its band); the paper halo keeps them readable where the cut-off, the listing or the
   polyline crosses. */
.tl-band-label { fill: #574F41; font-weight: 700; letter-spacing: .06em; paint-order: stroke; stroke: var(--putty); stroke-width: 3px; stroke-linejoin: round; }
.tl-tick, .tl-mark-label, .tl-axis-title { fill: #574F41; }
.tl-axis-title { font-family: var(--f-body); font-size: 12px; }
.tl-grid { stroke: rgba(59,52,39,.22); stroke-width: 1; }
.tl-cutoff { stroke: var(--putty-ink); stroke-width: 1.5; stroke-dasharray: 4 3; }
.tl-listing { stroke: var(--putty-ink); stroke-width: 1.5; }
.tl-line { fill: none; stroke: rgba(59,52,39,.55); stroke-width: 1.5; }
.tl-pt { stroke: var(--putty-ink); stroke-width: 1; fill: #7C7361; }
.tl-pt[data-d="EAT"] { fill: #2F7A46; }
.tl-pt[data-d="NIBBLE"] { fill: #9A6B14; }
.tl-pt[data-d="SPIT"] { fill: #B03127; }
.tl-pt[data-late] { fill: var(--putty); stroke-width: 2; }
.tl-pt[data-late][data-d="EAT"] { stroke: #2F7A46; }
.tl-pt[data-late][data-d="NIBBLE"] { stroke: #9A6B14; }
.tl-pt[data-late][data-d="SPIT"] { stroke: #B03127; }
.tl-ring { fill: none; stroke: var(--putty-ink); stroke-width: 1; }
.tl-research { fill: var(--putty-ink); }
.tl-stage { fill: var(--putty-ink); }
.tl-stage[data-late] { fill: var(--putty); stroke: var(--putty-ink); stroke-width: 1.5; }
.tl-stage-label { fill: var(--putty-ink); font-weight: 700; }
.tl-legend { display: flex; flex-wrap: wrap; gap: 2px 14px; margin: 4px 0 6px; font: var(--t-xs)/1.4 var(--f-mono); color: #574F41; }
.tl-key { font-style: normal; }
.tl-key[data-d="EAT"] { color: #2F7A46; }
.tl-points { margin: 4px 0; font: var(--t-sm)/1.5 var(--f-body); }
.tl-points summary { cursor: pointer; }
.tl-points .paper-note { margin: 6px 0 0; }
.tl-points ol, .tl-stages { display: grid; gap: 6px; margin: 6px 0 0; padding-left: 18px; font: var(--t-sm)/1.5 var(--f-body); }
.tl-stages { list-style: none; padding-left: 0; }
.tl-points b, .tl-stages b { font-family: var(--f-mono); font-weight: 700; }
.tl-stages li, .tl-points li { overflow-wrap: anywhere; }
.tl-stages li[data-missing] { color: #574F41; }
.tl-stages a { color: inherit; }
.tl-late { font-weight: 600; }
.tl-table { color: #574F41; }
/* Вторые мнения (second_opinions.py): справка в конце досье; во вкус, вердикт и ставку не входит. */
.second-opinions[hidden] { display: none; }
.second-opinions h4 { margin: 12px 0 2px; font: 700 var(--t-sm)/1.3 var(--f-body); }
.second-opinions .paper-note { margin: 0 0 6px; color: #574F41; opacity: 1; }
.second-opinions ul { display: grid; gap: 8px; margin: 0; padding-left: 18px; }
.second-opinions li { overflow-wrap: anywhere; }
.second-opinions a { color: inherit; }
.second-opinions .second-backtest { color: #574F41; }
.second-opinions li[data-late] .second-late { font-weight: 600; }
/* Участие в сделке (invest.js): ссылка на открытое предложение Ownit. Отдельный блок после ресерча, вне штампа,
   сайзинга и строки вердикта, одинаковый при любом вердикте; адреса и хеши переносятся, на телефоне без прокрутки вбок. */
.invest-panel { color-scheme: light; margin-top: 22px; padding: 14px 16px 16px; border: 2px solid rgba(59,52,39,.55); border-radius: 4px; max-width: 85ch; display: grid; gap: 12px; min-width: 0; overflow-wrap: anywhere; }
.invest-panel[hidden], .invest-offers:empty, .invest-stake-slot:empty { display: none; }
.invest-offers, .invest-offer { display: grid; gap: 10px; min-width: 0; }
.invest-panel p { margin: 0; }
.invest-title { margin: 0; font: 600 var(--t-lg)/1.3 var(--f-body); }
.invest-steps, .invest-warn, .invest-txs, .invest-status ul { margin: 0; padding-left: 22px; display: grid; gap: 3px; font-size: var(--t-sm); }
.invest-offer-name { font-weight: 700; }
.invest-pools { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.invest-pool { display: grid; gap: 2px; padding: 8px 10px; border: 1px dashed rgba(59,52,39,.45); border-radius: 3px; font-size: var(--t-sm); }
.invest-panel b { font-family: var(--f-mono); font-weight: 700; }
.invest-full { color: #8A2A20; font-weight: 600; }
.invest-fees { font-size: var(--t-sm); }
.invest-note, .invest-disclaimer { font-size: var(--t-sm); color: #574F41; }
.invest-go { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 18px; border-radius: 4px; background: var(--putty-ink); color: var(--putty); font: 600 var(--t-md)/1.2 var(--f-body); text-decoration: none; text-align: center; }
.invest-go:hover { background: #2A251C; }
.invest-go:focus-visible, .invest-stake button:focus-visible, .invest-stake summary:focus-visible, .invest-field :focus-visible { outline: 2px solid var(--putty-ink); outline-offset: 2px; }
.invest-stake { padding-top: 10px; border-top: 1px dashed rgba(59,52,39,.45); }
.invest-stake > summary { cursor: pointer; min-height: 32px; font: 600 var(--t-md)/1.4 var(--f-body); }
.invest-stake-body { display: grid; gap: 10px; margin-top: 8px; font-size: var(--t-sm); min-width: 0; }
.invest-warn-title, .invest-review-title { font-weight: 700; }
.invest-chain { display: grid; gap: 2px; }
.invest-chain:empty, .invest-status:empty { display: none; }
.invest-ack { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.invest-ack input { flex: none; width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--putty-ink); }
.invest-wallets, .invest-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.invest-form { display: grid; gap: 10px; min-width: 0; }
.invest-wallets[hidden], .invest-form[hidden], .invest-review[hidden], .invest-txs[hidden] { display: none; }
.invest-stake button { min-height: 40px; padding: 8px 14px; border: 1px solid var(--putty-ink); border-radius: 3px; background: transparent; color: var(--putty-ink); font: 600 var(--t-sm)/1.25 var(--f-body); cursor: pointer; text-align: left; }
.invest-stake button:hover { background: rgba(59,52,39,.1); }
.invest-stake button[data-invest="stake"] { background: var(--putty-ink); color: var(--putty); }
.invest-stake button:disabled { opacity: .55; cursor: progress; }
.invest-field { display: grid; gap: 4px; max-width: 420px; min-width: 0; }
.invest-field input, .invest-field select { width: 100%; min-width: 0; min-height: 40px; padding: 8px 10px; border: 1px solid rgba(59,52,39,.6); border-radius: 3px; background: #EFE7D3; color: var(--putty-ink); font: var(--t-md)/1.2 var(--f-mono); }
.invest-review { padding: 8px 10px; border: 1px dashed rgba(59,52,39,.45); border-radius: 3px; display: grid; gap: 6px; }
.invest-dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 3px 12px; margin: 0; }
.invest-dl dt { font-weight: 600; }
.invest-dl dd { margin: 0; min-width: 0; }
.invest-panel code, .invest-txs a { font: var(--t-xs)/1.45 var(--f-mono); word-break: break-all; }
.invest-txs a { color: inherit; }
.invest-tx-note { display: grid; gap: 2px; margin-top: 4px; min-width: 0; }
@media (max-width: 640px) {
  .invest-panel { padding: 12px; }
  .invest-go { display: flex; width: 100%; }
  .invest-dl { grid-template-columns: minmax(0, 1fr); }
  .invest-dl dd { margin-bottom: 4px; }
}
.caps-summary { margin: 8px 0 14px; max-width: 85ch; }
.caps-line { font: var(--t-sm)/1.5 var(--f-mono); }
.caps-details summary { cursor: pointer; font: var(--t-xs)/1.5 var(--f-mono); }
.paper-note { font: var(--t-xs)/1.5 var(--f-mono); opacity: 0.75; }
.paper-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-5); }


/* ---------- блоки ---------- */
.block { display: grid; gap: var(--s-5); }
.block-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s-2) var(--s-5); border-top: 1px solid var(--line); padding-top: var(--s-4); }
.block-head h2 { font: 700 var(--t-xl)/1.1 var(--f-display); }
.block-note { color: var(--muted); font-size: var(--t-sm); max-width: 70ch; }

.taste-col h3 { display: flex; align-items: center; gap: var(--s-2); font: 700 var(--t-md)/1.2 var(--f-display); margin-bottom: var(--s-3); letter-spacing: 0.04em; }
.swatch { width: 12px; height: 12px; box-shadow: inset 0 0 0 2px rgba(59,52,39,.5); }
.taste-col[data-kind="sugar"] .swatch { background: #C79A3E; }
.taste-col[data-kind="bitter"] .swatch { background: #6F8430; }
.neutral-col[hidden] { display: none; }
.taste-col[data-kind="neutral"] .swatch { background: #8A8377; }
.taste-col[data-kind="neutral"] .sig-val::before { content: "· "; }
.taste-col[data-kind="neutral"] .sig-bar i { background: #8A8377; }
.col-note { font: var(--t-xs)/1.2 var(--f-mono); opacity: 0.6; text-transform: none; letter-spacing: 0; margin-left: auto; }
.signals { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.signal { border-bottom: 1px dotted rgba(59,52,39,.4); }
.signal details { padding: 2px 0 8px; }
.signal summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: 62px minmax(0, 1fr); gap: 3px 10px; align-items: baseline; }
.signal summary::-webkit-details-marker { display: none; }
.signal summary:hover .sig-label { text-decoration: underline; text-underline-offset: 2px; }
.sig-val { font: 700 var(--t-sm)/1.3 var(--f-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.taste-col[data-kind="sugar"] .sig-val::before { content: "+ "; }
.taste-col[data-kind="bitter"] .sig-val::before { content: "− "; }
.sig-label { font: var(--t-sm)/1.4 var(--f-body); }
.sig-bar { grid-column: 2; height: 4px; background: rgba(59,52,39,.18); position: relative; }
.sig-bar i { position: absolute; inset: 0 auto 0 0; }
.taste-col[data-kind="sugar"] .sig-bar i { background: #C79A3E; }
.taste-col[data-kind="bitter"] .sig-bar i { background: #6F8430; }
.sig-meta { grid-column: 2; font: var(--t-xs)/1.4 var(--f-mono); opacity: 0.65; }
.sig-body { margin: 8px 0 2px 72px; font: var(--t-sm)/1.55 var(--f-mono); white-space: pre-line; max-width: 70ch; }
.sig-src { margin: 8px 0 0 72px; display: flex; flex-wrap: wrap; gap: 4px 12px; font: var(--t-xs)/1.4 var(--f-mono); }
.sig-src a { color: #6B4E1E; }
.sig-src a:hover { color: var(--putty-ink); }

.rivals-block[hidden] { display: none; }
.research-prose { line-height: 1.6; overflow-wrap: anywhere; }
.research-prose h4 { margin: 18px 0 6px; }
.research-prose p { white-space: pre-line; }
.research-prose a { color: inherit; }


.brain { display: grid; grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr); gap: var(--s-6); align-items: start; }
figure { margin: 0; display: grid; gap: var(--s-3); }
.raster-wrap { background: var(--bench-deep); border: 1px solid var(--line); }
#raster { display: block; width: 100%; height: auto; max-width: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: var(--t-xs); color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; display: inline-block; }
.legend [data-kind="sugar"] i { background: var(--sugar); }
.legend [data-kind="bitter"] i { background: var(--bitter); }
.legend [data-kind="mn9"] i { background: var(--mn9); }
.legend [data-kind="other"] i { background: var(--other); }
.map-wrap { background: var(--bench-deep); border: 1px solid var(--line); padding: var(--s-2); }
#taste-map { display: block; width: 100%; height: auto; }
.map-fig figcaption { font-size: var(--t-xs); color: var(--muted); }

.table-wrap { overflow-x: auto; }
.log { width: 100%; border-collapse: collapse; font-size: var(--t-sm); }
.log th { text-align: left; font: var(--t-xs)/1 var(--f-mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.log td { padding: 10px 12px; border-bottom: 1px solid #2C333B; white-space: nowrap; }
.log .num { text-align: right; font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.pill { font: 700 var(--t-xs)/1 var(--f-display); letter-spacing: 0.08em; padding: 4px 8px; border: 2px solid currentColor; }
.pill[data-d="EAT"] { color: var(--eat); }
.pill[data-d="NIBBLE"] { color: var(--nibble); }
.pill[data-d="SPIT"] { color: var(--spit); }
.log .act { font-family: var(--f-mono); color: var(--muted); }

/* ---------- табло прогнозов (forecast_scoreboard.py) ---------- */
.scoreboard[hidden] { display: none; }
.score-sums { display: grid; gap: var(--s-2); font-size: var(--t-sm); }
.score-sum, .score-venues { margin: 0; line-height: 1.7; overflow-wrap: anywhere; }
.score-sum .pill { display: inline-block; margin-right: 6px; }
.score-sums b, .score-notes b { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.score-venues { color: var(--muted); }
.score-table a { color: var(--ink); }
.score-table .score-none { color: var(--muted); }
.score-table td[data-sign="up"] { color: var(--eat); }
.score-table td[data-sign="down"] { color: var(--spit); }
.score-notes { display: grid; gap: 6px; max-width: 80ch; color: var(--muted); font-size: var(--t-sm); line-height: 1.5; }
.score-notes p { margin: 0; overflow-wrap: anywhere; }
.score-notes a { color: var(--ink); }
@media (max-width: 640px) {
  .score-table th, .score-table td { padding: 8px; }
  .score-table td:nth-child(2) { white-space: normal; min-width: 132px; }   /* длинное имя сделки не выталкивает вердикт за экран */
}

/* ---------- FAQ ---------- */
.faq-list { display: grid; gap: 2px; }
.faq-item { background: var(--panel); }
.faq-item > summary {
  cursor: pointer; list-style: none; padding: 14px 16px; display: flex; gap: var(--s-3);
  font: 500 var(--t-md)/1.3 var(--f-body); color: var(--ink);
}
.faq-item > summary::-webkit-details-marker { display: none; }
.faq-item > summary::before { content: "+"; color: var(--phosphor); font-family: var(--f-mono); }
.faq-item[open] > summary::before { content: "−"; }
.faq-item[open] > summary { color: var(--phosphor); }
.faq-item > p { padding: 0 16px 16px 40px; font-size: var(--t-sm); color: #CFC9BD; max-width: 78ch; }

/* ---------- узкие экраны ---------- */
@media (max-width: 1100px) {
  .page { grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "side" "main"; }
  .side { position: static; height: clamp(280px, 42dvh, 440px); gap: 12px; }
}
@media (max-width: 900px) {
  .lab-bar { grid-template-columns: minmax(0, 1fr); }
  .paper { padding-left: 38px; }
  .brain { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .active-deals-list > li { flex: 0 0 min(82%, 320px); max-width: none; }
  .brand-name { font-size: var(--t-xl); }
  .paper-cols { grid-template-columns: minmax(0, 1fr); }
  .paper-title { font-size: var(--t-xl); }
  .paper-head-side { width: 100%; margin-left: 0; justify-content: flex-start; }
  .paper-switch { order: 3; width: 100%; max-width: none; margin-left: 0; justify-items: start; }
  .paper-verdict-head { order: -1; justify-items: start; min-width: 0; }   /* the stamp has its own row here */
  .paper-switch .scenario-switch { justify-self: start; }
  .gauge { grid-template-columns: 96px minmax(80px, 1fr) 72px; }
  .stamp { font-size: 32px; }
  .terminal { height: 260px; font-size: 13px; }
  .fly-bubble { left: 3%; top: 3%; font-size: 15px; padding: 5px 9px 6px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
/* Ownit monitoring and the evidence-based IPO conclusion. */
.ipo-dossier { padding: 4px 0 22px; line-height: 1.6; overflow-wrap: anywhere; }
.ipo-dossier h3 { font-size: 18px; }
.ipo-dossier h4 { margin: 18px 0 6px; }
.ipo-dossier ul { padding-left: 20px; }
.ipo-dossier a { color: inherit; }
.ipo-day-one { border-left: 3px solid var(--putty-ink); padding: 4px 0 12px 16px; margin-bottom: 22px; }
.ipo-day-one details { margin-top: 8px; }
.ipo-day-one summary { cursor: pointer; }
.pill[data-d="WAIT"] { color: var(--muted); }
.pill[data-d="DONE"] { color: var(--ink); letter-spacing: 0; white-space: nowrap; }
.stamp[data-d="DONE"] { font-size: clamp(22px, 3vw, 36px); }
.ipo-table-wrap { overflow-x: auto; max-width: 100%; margin: 10px 0; }
.ipo-table-wrap table { width: 100%; border-collapse: collapse; font-size: 14px; color: var(--putty-ink); color-scheme: light; }
.ipo-table-wrap th, .ipo-table-wrap td { color: inherit; text-align: left; padding: 7px 10px; border-bottom: 1px solid rgba(59,52,39,.25); }
.ipo-mechanics > summary { font-weight: 600; }

/* Equity history stays separate from the simulated taste of the fly. */
.equity-history { scroll-margin-top: 24px; margin-block: 24px; padding: clamp(16px, 3vw, 32px); border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.equity-history h2 { margin: 0 0 20px; font-size: 28px; }
.equity-history h3 { margin-top: 28px; }
.equity-history p, .equity-history li { font-size: 14px; line-height: 1.65; }
.equity-history a, .history-signal a { color: var(--phosphor); overflow-wrap: anywhere; }
.history-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 20px; }
.history-metrics > div { padding: 16px; border: 1px solid var(--line); border-radius: 8px; }
.history-metrics strong { display: block; font: 28px var(--f-mono); color: var(--phosphor); }
.history-metrics span { display: block; margin-top: 8px; font-size: 12px; color: var(--muted); }
.equity-history details { border-top: 1px solid var(--line); padding-block: 14px; }
.equity-history summary { cursor: pointer; line-height: 1.6; }
.history-table { overflow-x: auto; margin-block: 16px; }
.history-table table { width: 100%; border-collapse: collapse; font-size: 13px; }
.history-table th, .history-table td { padding: 11px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.history-table th { color: var(--muted); font-weight: 400; }
.history-table td:last-child { white-space: nowrap; font-family: var(--f-mono); }
.history-table small { display: block; color: var(--muted); }
.history-gain { color: var(--eat); } .history-loss { color: #ff9388; }
.history-filter { display: block; font-size: 13px; color: var(--muted); }
.history-filter input { display: block; width: 100%; padding: 12px; margin-top: 8px; color: var(--ink); background: var(--bench); border: 1px solid var(--line); border-radius: 6px; font: inherit; }
.history-deal summary span { display: block; margin-left: 20px; color: var(--muted); font-size: 12px; }
.history-signal { border-left: 3px solid var(--phosphor-dim); padding: 4px 16px; margin-block: 16px; }
.history-signal h4 { margin-top: 8px; }
.history-signal p { font-size: 14px; }
.history-warning { padding: 12px; border: 1px solid var(--nibble); border-radius: 6px; }
@media (max-width: 640px) { .history-metrics { grid-template-columns: 1fr; gap: 8px; } .history-metrics > div { padding: 12px; } }

#dossier { scroll-margin-top: 16px; }
.paper-kicker a { color: inherit; }
.equity-history > summary { font-size: 16px; font-weight: 600; }
#equity-history-content { margin-top: 24px; }

/* IPO decision explanation uses the same assessment as the sidebar and report. */
.ipo-explanation { margin: 14px 0; }
.ipo-explanation h4 { margin-bottom: 8px; }
.ipo-explanation .ipo-decision-summary { font-size: 1.05em; line-height: 1.6; }
.ipo-decision-limit { border-left: 3px solid var(--muted); padding-left: 12px; }
.ipo-business-risks li { margin-bottom: 14px; }
.ipo-business-risks li p { font-size: .95em; font-weight: normal; }
#research-signals { margin: 24px 0; }
#research-signals > .paper-cols { margin-top: 0; }
#research-signals > .paper-choice:not([hidden]) + .paper-cols { margin-top: 16px; }

/* Primary sensory decision: same inputs, animation and verdict. */
#brain-details { margin: 0 0 28px; padding: 0 0 28px; border-bottom: 2px dashed var(--muted); }
.balance-title { margin: 0 0 20px; font-family: "Pixelify Sans", sans-serif; font-size: 23px; }
#brain-details .paper-gauges { margin-top: 0; }
.taste-rules ol { padding-left: 24px; }
.taste-rules li { margin: 10px 0; line-height: 1.5; }
#research-signals .paper-note { max-width: 85ch; }

/* Compact scenario calculator inside the selected paper dossier. */
.profit-lab { min-width: 0; padding: 16px; display: grid; gap: 10px; border: 1px solid rgba(59,52,39,.32); border-top: 3px solid #9A6B14; border-radius: 5px; background: rgba(255,249,232,.23); color: var(--putty-ink); color-scheme: light; overflow-wrap: anywhere; }
.profit-lab[hidden] { display: none; }
.profit-head { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: baseline; justify-content: space-between; }
.profit-head h3 { font: 700 21px/1.15 var(--f-display); }
.profit-tag { padding: 3px 7px; border: 1px solid rgba(59,52,39,.3); border-radius: 3px; font: 11px/1.3 var(--f-mono); white-space: nowrap; }
.profit-caption { font: 12px/1.45 var(--f-mono); opacity: .8; }
.profit-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; max-width: 550px; align-items: end; }
.profit-controls label { display: grid; min-width: 0; gap: 5px; font-size: 12px; line-height: 1.35; }
.profit-controls input { width: 100%; min-width: 0; min-height: 40px; padding: 7px 10px; border: 1px solid rgba(59,52,39,.45); border-radius: 3px; background: #E9E0CE; color: var(--putty-ink); font: 16px/1.25 var(--f-mono); font-variant-numeric: tabular-nums; }
.profit-controls input:focus-visible { outline: 2px solid #9A6B14; outline-offset: 2px; }
.profit-controls input:disabled { opacity: .6; cursor: not-allowed; }
.profit-assumption, .profit-footnote { font-size: 12px; line-height: 1.45; }
.profit-assumption { opacity: .85; }
.profit-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; min-width: 0; }
.profit-case { min-width: 0; padding: 10px 11px; display: grid; align-content: start; gap: 4px; border: 1px solid rgba(59,52,39,.2); border-top: 3px solid #9A6B14; border-radius: 3px; background: rgba(255,249,232,.32); }
.profit-case[data-scenario="negative"] { border-top-color: #A15040; }
.profit-case[data-scenario="optimistic"] { border-top-color: #517747; }
.profit-case h4 { margin: 0; font-size: 13px; line-height: 1.3; font-weight: 600; }
.profit-quantile { font: 10px/1.3 var(--f-mono); opacity: .65; }
.profit-result { display: block; margin-top: 4px; font: 700 clamp(20px, 2.1vw, 28px)/1.15 var(--f-mono); font-variant-numeric: tabular-nums; letter-spacing: -.04em; }
.profit-net { font-size: 12px; line-height: 1.35; font-weight: 500; }
.profit-market { font: 10px/1.4 var(--f-mono); opacity: .75; }
.profit-footnote { opacity: .8; }
.profit-method { min-width: 0; border-top: 1px dashed rgba(59,52,39,.3); padding-top: 8px; font-size: 12px; line-height: 1.5; }
.profit-method > summary { cursor: pointer; font-weight: 600; }
.profit-method > :not(summary) { margin-top: 8px; }
.profit-method ul, .profit-method ol { padding-left: 20px; }
.profit-lab a { color: inherit; }
.profit-method summary:focus-visible, .profit-lab a:focus-visible { outline-color: #9A6B14; }
@media (max-width: 520px) {
  .profit-lab { padding: 12px; gap: 9px; }
  .profit-head h3 { font-size: 19px; }
  .profit-grid { grid-template-columns: minmax(0, 1fr); gap: 7px; }
  .profit-case { grid-template-columns: minmax(0, 1fr) auto; gap: 3px 10px; padding: 8px 10px; }
  .profit-case h4 { grid-column: 1; }
  .profit-quantile { grid-column: 2; grid-row: 1; text-align: right; }
  .profit-result { grid-column: 1; grid-row: 2; font-size: 23px; margin-top: 1px; }
  .profit-net { grid-column: 2; grid-row: 2; max-width: 13ch; text-align: right; align-self: center; }
  .profit-market { grid-column: 1 / -1; }
}

/* ---------- серый рынок HKEX (hk_grey.js): правила бэктеста GMP с палитрой бумаги, не вкус ---------- */
/* Две классовые части перебивают .india-gmp ниже. Цвета под бумагу #D6CBB2: точки ≥ 3:1, текст ≥ 4.5:1. */
.india-gmp.hk-grey { --ink: var(--putty-ink); --muted: #574F41; --line: rgba(59,52,39,.28); --panel: transparent; --phosphor: #8A5A00;
  --other: #4F5963; --putty: rgba(59,52,39,.7); --bench-deep: #E9E0CE;
  margin-top: 18px; padding: 18px 0 0; border: 0; border-top: 1px dashed rgba(59,52,39,.45); color: var(--putty-ink); scroll-margin-top: 16px; }
.india-gmp.hk-grey h3 { font-size: 23px; }
.india-gmp.hk-grey h3:focus { outline: none; }
.india-gmp.hk-grey h4 { margin: 0 0 6px; font: 700 var(--t-md)/1.3 var(--f-display); letter-spacing: .04em; }
.india-gmp.hk-grey h5 { margin: 0 0 6px; font: 600 var(--t-sm)/1.3 var(--f-body); }
.india-gmp.hk-grey a { color: inherit; text-underline-offset: 3px; }
.india-gmp.hk-grey .gmp-lead { color: inherit; }
.india-gmp.hk-grey .paper-kicker, .india-gmp.hk-grey .gmp-tag { color: var(--muted); opacity: 1; }
.india-gmp.hk-grey .gmp-neg { color: #A3271D; }
.india-gmp.hk-grey .gmp-caveat { border-left-color: #9A6B14; }
.india-gmp.hk-grey .gmp-table table { color: var(--putty-ink); }
.india-gmp.hk-grey .gmp-table th { white-space: normal; vertical-align: bottom; }
.india-gmp.hk-grey .gmp-loss { fill: rgba(176,49,39,.16); }
.india-gmp.hk-grey .gmp-dot { fill-opacity: .85; }
.india-gmp.hk-grey .gmp-dot.gmp-down { fill: #A3271D; }
.india-gmp.hk-grey .gmp-dot.gmp-peer { fill: #E09A1F; fill-opacity: 1; stroke: var(--putty-ink); stroke-width: 1.5; }
.india-gmp.hk-grey .gmp-dot.gmp-forward { fill: transparent; stroke: var(--putty-ink); stroke-width: 1.6; }
.india-gmp.hk-grey .gmp-svg .gmp-dot:hover, .india-gmp.hk-grey .gmp-svg .gmp-dot:focus { stroke: #1F1A12; stroke-width: 3.2; outline: none; }
.hkg-marker { stroke: #6B4708; stroke-width: 2; stroke-dasharray: 6 4; }
.hkg-marker-label { fill: #4A3205; font: 600 12px var(--f-mono); paint-order: stroke; stroke: #D6CBB2; stroke-width: 4px; stroke-linejoin: round; }
.hkg-own { fill: #1F1A12; stroke: #D6CBB2; stroke-width: 1.5; }
.hkg-rejected td { text-decoration: line-through; opacity: .75; }
.hkg-short .gmp-tag { white-space: normal; }   /* длинная английская плашка иначе расширяет досье на телефоне */

/* ---------- бэктест GMP индийских IPO: справка рядом с вердиктом, не вкус ---------- */
.side-link { margin: 8px 0 0; font-size: 12px; }
.gmp-peers { margin-top: 18px; padding-top: 12px; border-top: 1px dashed rgba(59,52,39,.45); max-width: 85ch; font-size: var(--t-sm); }
.gmp-peers[hidden], .india-gmp[hidden] { display: none; }
.gmp-peers p { margin: 6px 0; }
.gmp-peers a { color: inherit; text-underline-offset: 3px; }
.gmp-peers-title { margin: 0 0 6px; font: 600 var(--t-md)/1.3 var(--f-body); }
.gmp-tag { font: var(--t-xs)/1.4 var(--f-mono); opacity: .7; white-space: nowrap; }
.gmp-peers-title .gmp-tag, .gmp-dossier-deal .gmp-tag { white-space: normal; }   /* длинная английская плашка иначе расширяет всё досье на телефоне */
.gmp-peers-details summary { cursor: pointer; font: var(--t-xs)/1.5 var(--f-mono); }
.gmp-table { overflow-x: auto; max-width: 100%; margin: 10px 0; }
.gmp-table table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; color: var(--ink); }  /* без doctype таблицы не наследуют цвет */
.gmp-table th, .gmp-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid currentColor; border-bottom-color: color-mix(in srgb, currentColor 22%, transparent); white-space: nowrap; }
.gmp-table td:first-child { white-space: normal; min-width: 12ch; }
.gmp-table th { white-space: normal; vertical-align: bottom; }   /* узкие колонки на телефоне: переносится заголовок, не значение */
.gmp-neg { color: #B03127; }
.india-gmp { padding: clamp(16px, 3vw, 32px); border: 1px solid var(--line); background: var(--panel); display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; min-width: 0; scroll-margin-top: 24px; }
.india-gmp > * { min-width: 0; }
.india-gmp a { color: var(--phosphor); overflow-wrap: anywhere; }
.india-gmp h2 { margin: 4px 0 8px; font: 700 var(--t-2xl)/1.05 var(--f-display); }
.india-gmp h3 { margin: 0 0 8px; font: 700 var(--t-xl)/1.15 var(--f-display); }
.india-gmp h4 { margin: 0 0 6px; font: 600 var(--t-md)/1.3 var(--f-body); }
.india-gmp p { margin: 6px 0; font-size: var(--t-sm); line-height: 1.6; max-width: 90ch; }
.india-gmp .paper-note { color: var(--muted); opacity: 1; }
.india-gmp .gmp-neg { color: #F08A80; }
.gmp-lead { color: #CFC9BD; }
.gmp-caveat { border-left: 3px solid var(--phosphor); padding: 4px 0 4px 14px; }
.gmp-meta { font: var(--t-xs)/1.6 var(--f-mono); color: var(--muted); }
.gmp-meta b { color: var(--ink); }
.gmp-controls { display: flex; flex-wrap: wrap; gap: 12px 24px; font-size: var(--t-sm); }
.gmp-controls label { display: inline-flex; align-items: center; gap: 8px; }
.gmp-controls select { font: inherit; color: var(--ink); background: var(--bench-deep); border: 1px solid var(--line); padding: 6px 8px; }
.gmp-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.gmp-chart { margin: 0; min-width: 0; }
.gmp-chart figcaption { font: 600 var(--t-md)/1.3 var(--f-body); margin-bottom: 8px; }
.gmp-svg { width: 100%; height: auto; display: block; }
.gmp-gridline { stroke: var(--line); stroke-width: 1; }
.gmp-zero { stroke: var(--putty); stroke-width: 1.6; }
.gmp-loss { fill: rgba(224, 69, 58, .08); }
.gmp-diagonal { stroke: var(--muted); stroke-dasharray: 4 5; }
.gmp-tick { fill: var(--muted); font: 11px var(--f-mono); }
.gmp-axis { fill: var(--ink); font: 12px var(--f-body); }
.gmp-dot { fill: var(--other); fill-opacity: .8; cursor: pointer; }
.gmp-dot.gmp-down { fill: #E07A70; }
.gmp-dot.gmp-peer { fill: var(--phosphor); fill-opacity: 1; stroke: var(--bench-deep); stroke-width: 1.5; }
.gmp-dot:hover, .gmp-dot:focus { stroke: var(--ink); stroke-width: 2; outline: none; }
.gmp-point { min-height: 3.2em; font-size: var(--t-sm); }
.gmp-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.gmp-stats > div { border: 1px solid var(--line); padding: 10px; }
.gmp-stats b { display: block; font: 700 22px/1.1 var(--f-mono); color: var(--phosphor); }
.gmp-stats span { display: block; margin-top: 6px; font-size: 12px; color: var(--muted); }
.gmp-evals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.gmp-bar { display: grid; grid-template-columns: minmax(10ch, 14em) minmax(40px, 1fr) auto auto; gap: 4px 8px; align-items: center; font-size: 13px; margin: 6px 0; }
.gmp-bar i { height: 10px; background: var(--other); display: block; }
.gmp-bar.gmp-best i { background: var(--phosphor); }
.gmp-bar b { font-family: var(--f-mono); }
.gmp-query { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.gmp-sources ul { margin: 6px 0 0; padding-left: 18px; font-size: 12px; }
@media (max-width: 900px) { .gmp-grid, .gmp-evals { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 520px) { .gmp-stats { grid-template-columns: minmax(0, 1fr); } .gmp-bar { grid-template-columns: minmax(0, 1fr) auto auto; } .gmp-bar i { grid-column: 1 / -1; grid-row: 2; } }
.gmp-dot.gmp-forward { fill: transparent; stroke: var(--ink); stroke-width: 1.6; }
.gmp-dot.gmp-forward.gmp-peer { fill: var(--phosphor); }
.gmp-svg .gmp-dot:hover, .gmp-svg .gmp-dot:focus { stroke: var(--ink); stroke-width: 2.4; outline: none; }
.gmp-svg .gmp-dot.gmp-forward:hover, .gmp-svg .gmp-dot.gmp-forward:focus { stroke: var(--phosphor); stroke-width: 3; }
/* Полный бэктест GMP в бумажном досье: правила страницы /india-gmp с палитрой бумаги. */
/* Цвета подобраны под бумагу #D6CBB2: точки ≥ 3:1, текст ≥ 4.5:1. */
.gmp-dossier { --ink: var(--putty-ink); --muted: #574F41; --line: rgba(59,52,39,.28); --panel: transparent; --phosphor: #8A5A00;
  --other: #4F5963; --putty: rgba(59,52,39,.7); --bench-deep: #E9E0CE;
  padding: 18px 0 0; border: 0; border-top: 1px dashed rgba(59,52,39,.45); color: var(--putty-ink); scroll-margin-top: 16px; }
.gmp-dossier h3 { font-size: 23px; }
.gmp-dossier h3:focus { outline: none; }
.gmp-dossier h4 { margin: 0 0 6px; font: 700 var(--t-md)/1.3 var(--f-display); letter-spacing: .04em; }
.gmp-dossier h5 { margin: 0 0 6px; font: 600 var(--t-sm)/1.3 var(--f-body); }
.gmp-dossier a { color: inherit; text-underline-offset: 3px; }
.gmp-dossier .gmp-lead { color: inherit; }
.gmp-dossier .paper-kicker, .gmp-dossier .gmp-tag { color: var(--muted); opacity: 1; }
.gmp-dossier .gmp-neg { color: #A3271D; }
.gmp-dossier .gmp-caveat { border-left-color: #9A6B14; }
.gmp-dossier .gmp-loss { fill: rgba(176,49,39,.16); }
.gmp-dossier .gmp-dot { fill-opacity: .85; }
.gmp-dossier .gmp-dot.gmp-down { fill: #A3271D; }
.gmp-dossier .gmp-dot.gmp-peer { fill: #E09A1F; fill-opacity: 1; stroke: var(--putty-ink); stroke-width: 1.5; }
.gmp-dossier .gmp-dot.gmp-forward { fill: transparent; stroke: var(--putty-ink); stroke-width: 1.6; }
.gmp-dossier .gmp-dot.gmp-forward.gmp-peer { fill: #E09A1F; }
.gmp-dossier .gmp-svg .gmp-dot:hover, .gmp-dossier .gmp-svg .gmp-dot:focus { stroke: #1F1A12; stroke-width: 3.2; outline: none; }
.gmp-marker { stroke: #6B4708; stroke-width: 2; stroke-dasharray: 6 4; }
.gmp-marker-label { fill: #4A3205; font: 600 12px var(--f-mono); paint-order: stroke; stroke: #D6CBB2; stroke-width: 4px; stroke-linejoin: round; }
.india-gmp:not(.gmp-dossier) .gmp-marker { stroke: var(--phosphor); }
.india-gmp:not(.gmp-dossier) .gmp-marker-label { fill: var(--phosphor); stroke: var(--panel); }
