@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  /* Inter 4 subset: Latin, Cyrillic and ₽ in one file so kerning works across scripts. */
  src: url("fonts/inter.woff2") format("woff2");
}
:root {
  color-scheme: dark;
  --bg: #0e0e0f;
  --surface: #18181a;
  --surface-alt: #202023;
  --line: rgb(255 255 255 / 7%);
  --text: #f2f2f0;
  --muted: #8b8c91;
  --faint: #5f6066;
  --yellow: #ffdd2d;
  --ink: #151515;
  --positive: #2fc172;
  --negative: #ff5f5f;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
}
main {
  max-width: 1240px;
  padding: 0 32px 40px;
  margin: auto;
}
h1,
h2,
p {
  margin: 0;
}
svg {
  display: block;
  width: 100%;
}
a {
  color: var(--yellow);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}
small,
.muted {
  color: var(--muted);
}
.positive {
  color: var(--positive);
}
.negative {
  color: var(--negative);
}
.warning {
  color: var(--yellow);
}
button {
  font: inherit;
  font-size: 13px;
  border: 0;
  border-radius: 999px;
  padding: 8px 16px;
  background: var(--surface-alt);
  color: var(--text);
  cursor: pointer;
}
button:hover {
  background: #2a2a2e;
}
button:focus-visible,
a:focus-visible,
summary:focus-visible,
input:focus-visible {
  outline: 2px solid var(--yellow);
  outline-offset: 3px;
}

/* Header */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 24px 0 16px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.015em;
}
.brand-mark {
  box-shadow: 0 0 18px rgb(255 221 45 / 28%);
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--yellow);
  color: var(--ink);
  font-weight: 800;
}
.brand-mark.large {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  font-size: 24px;
  margin-bottom: 24px;
}
.source {
  margin-right: auto;
  color: var(--muted);
  font-size: 13px;
}
.periods {
  display: flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--surface);
}
.periods a {
  padding: 6px 13px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
}
.periods a:hover {
  color: var(--text);
  text-decoration: none;
}
.periods a[aria-current] {
  background: var(--yellow);
  color: var(--ink);
  font-weight: 600;
  box-shadow:
    0 0 0 1px rgb(255 240 150 / 60%) inset,
    0 0 18px rgb(255 221 45 / 35%);
}
.status-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  padding: 0;
  margin: 0 0 20px;
  list-style: none;
  color: var(--muted);
  font-size: 13px;
}
.status-strip li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.status-strip i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--faint);
}
.status-strip .state-ok i {
  background: var(--positive);
}
.status-strip .state-bad {
  color: var(--negative);
}
.status-strip .state-bad i {
  background: var(--negative);
}
.status-strip .state-live {
  color: var(--yellow);
}
.status-strip .state-live i {
  background: var(--yellow);
}
.alert {
  margin-bottom: 16px;
  padding: 12px 18px;
  border-radius: 14px;
  background: rgb(255 221 45 / 8%);
  color: var(--yellow);
  font-size: 13px;
}

/* Cards */
.card {
  padding: 24px;
  border-radius: 20px;
  background: var(--surface);
  min-width: 0;
}
.label {
  color: var(--muted);
  font-size: 13px;
}
h2 {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 18px;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.014em;
}
h2 span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}
.footnote {
  margin-top: 16px;
  color: var(--faint);
  font-size: 12px;
  line-height: 1.55;
}

/* Hero */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr);
  gap: 12px;
}
.as-of {
  font-size: 12px;
  white-space: nowrap;
}
.capital {
  display: flex;
  flex-direction: column;
}
.capital .label,
.capital .as-of,
.capital dt,
.capital figcaption {
  color: var(--muted);
}
.capital-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}
.capital-value {
  margin: 6px 0 10px;
  color: var(--yellow);
  font-size: clamp(40px, 5vw, 60px);
  font-weight: 700;
  letter-spacing: -0.028em;
  line-height: 1.05;
  text-shadow: 0 0 28px rgb(255 221 45 / 22%);
}
.capital-delta {
  font-size: 13px;
  color: var(--muted);
}
.pill {
  display: inline-block;
  margin-right: 8px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgb(255 255 255 / 6%);
  color: var(--text);
  font-weight: 600;
}
.pill.positive {
  color: var(--positive);
}
.pill.negative {
  color: var(--negative);
}
.capital-chart {
  margin: auto -12px 0;
  padding-top: 20px;
}
.capital-chart svg {
  overflow: visible;
}
.capital-chart .line {
  fill: none;
  stroke: var(--yellow);
  stroke-width: 2.25;
  stroke-linejoin: round;
  stroke-linecap: round;
  filter: drop-shadow(0 0 4px rgb(255 221 45 / 55%));
}
.capital-chart .last-dot {
  fill: var(--yellow);
  filter: drop-shadow(0 0 5px rgb(255 221 45 / 80%));
}
.capital-chart .hit {
  fill: transparent;
}
.capital-chart figcaption {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  padding: 0 12px;
  font-size: 12px;
}
.chart-empty {
  margin-top: 24px;
  font-size: 13px;
  color: var(--muted);
}
.capital-split {
  display: flex;
  gap: 32px;
  margin: 18px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.capital-split dt {
  font-size: 12px;
}
.capital-split dd {
  margin: 2px 0 0;
  font-weight: 650;
}
.benchmark {
  display: flex;
  flex-direction: column;
}
.benchmark .footnote {
  margin-top: auto;
  padding-top: 16px;
}
.benchmark-gap {
  margin: 8px 0 20px;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.022em;
}
.versus {
  display: grid;
  gap: 14px;
}
.versus div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 12px;
  font-size: 14px;
}
.versus span {
  color: var(--muted);
}
.versus svg {
  grid-column: 1 / -1;
  height: 4px;
  border-radius: 999px;
}
.track {
  fill: rgb(255 255 255 / 7%);
}
.bar {
  fill: var(--yellow);
}
.bar-muted {
  fill: #6b6d73;
}
.bar-positive {
  fill: var(--positive);
}
.bar-negative {
  fill: var(--negative);
}

/* Positions and allocation */
.board {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 12px;
  margin-top: 12px;
}
.table-scroll {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
th {
  padding: 0 8px 10px;
  color: var(--faint);
  font-size: 12px;
  font-weight: 500;
  text-align: right;
}
td {
  padding: 14px 8px;
  border-top: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
  vertical-align: middle;
}
th:first-child,
td:first-child {
  padding-left: 0;
  text-align: left;
}
th:last-child,
td:last-child {
  padding-right: 0;
}
td:first-child {
  display: flex;
  align-items: center;
  gap: 12px;
  white-space: normal;
  min-width: 200px;
}
td strong {
  display: block;
  font-weight: 600;
}
td small {
  display: block;
  margin-top: 2px;
  font-size: 12px;
}
.ticker-badge {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--yellow);
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}
.ticker-badge.cash {
  margin-right: 12px;
  background: var(--surface-alt);
  color: var(--text);
}
.result-cell {
  font-weight: 600;
}
.result-cell small {
  font-weight: 500;
}
.cash-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 14px;
}
.cash-row > span {
  display: flex;
  align-items: center;
}
.donut {
  position: relative;
  width: min(200px, 100%);
  margin: 4px auto 22px;
}
.donut-track,
.donut-segment {
  fill: none;
  stroke-width: 3.6;
}
.donut-segment.shade-0 {
  filter: drop-shadow(0 0 2px rgb(255 221 45 / 45%));
}
.donut-track {
  stroke: rgb(255 255 255 / 5%);
}
.donut-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  padding: 0 46px;
  text-align: center;
}
.donut-center b {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.donut-center span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}
.shade-0 {
  stroke: var(--yellow);
  background: var(--yellow);
}
.shade-1 {
  stroke: #d8d9dc;
  background: #d8d9dc;
}
.shade-2 {
  stroke: #a2a4a9;
  background: #a2a4a9;
}
.shade-3 {
  stroke: #6e7075;
  background: #6e7075;
}
.shade-4 {
  stroke: #46484c;
  background: #46484c;
}
.shade-cash {
  stroke: #8a7a3a;
  background: #8a7a3a;
}
.legend {
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
  font-size: 13.5px;
}
.legend li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
}
.legend i,
.forecast-counts i {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 10px;
  border-radius: 50%;
}
.legend span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #c4c5c9;
}
.legend b {
  font-weight: 600;
}

/* Decision and operations */
.lower {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  margin-top: 12px;
  align-items: start;
}
.thinking {
  align-self: start;
}
.thinking-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.thinking h2 {
  margin: 10px 0 6px;
}
.badge {
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--surface-alt);
  font-size: 12.5px;
  font-weight: 600;
}
.action-wait,
.action-check {
  background: var(--yellow);
  color: var(--ink);
}
.action-buy {
  background: rgb(47 193 114 / 15%);
  color: var(--positive);
}
.action-sell {
  background: rgb(255 95 95 / 15%);
  color: var(--negative);
}
.thinking-text {
  margin: 16px 0;
  font-size: 16px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.thinking-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 14px;
}
.thinking-facts dt {
  color: var(--faint);
  font-size: 12px;
}
.thinking-facts dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
}
.activity summary {
  list-style: none;
  cursor: pointer;
}
.activity summary::-webkit-details-marker {
  display: none;
}
.flow-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 16px;
}
.flow-summary dt {
  color: var(--faint);
  font-size: 12px;
}
.flow-summary dd {
  margin: 2px 0 0;
  font-weight: 600;
  white-space: nowrap;
}
.timeline {
  padding: 0;
  margin: 0;
  list-style: none;
}
.timeline li {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto auto;
  gap: 14px;
  align-items: start;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  font-size: 14px;
}
.timeline-dot {
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--faint);
}
.kind-deposit .timeline-dot,
.kind-dividend .timeline-dot,
.kind-coupon .timeline-dot {
  background: var(--yellow);
}
.kind-sell .timeline-dot {
  background: var(--positive);
}
.status-cancelled {
  opacity: 0.5;
}
.timeline-main strong {
  font-weight: 600;
}
.timeline-main small,
.timeline-date small,
.timeline-amount small {
  display: block;
  margin-top: 2px;
  font-size: 12px;
}
.timeline-date {
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
}
.timeline-amount {
  min-width: 110px;
  text-align: right;
  font-weight: 600;
  white-space: nowrap;
}
.timeline-amount small {
  font-weight: 400;
}
.pagination {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 13px;
}

/* Journal */
.journal {
  margin-top: 12px;
}
.journal > .footnote:first-of-type {
  margin: -8px 0 18px;
}
.outcome-bar {
  height: 6px;
  margin: 4px 0 14px;
  border-radius: 999px;
  overflow: hidden;
}
.outcome-succeeded {
  fill: var(--positive);
  background: var(--positive);
}
.outcome-partially {
  fill: var(--yellow);
  background: var(--yellow);
}
.outcome-failed {
  fill: var(--negative);
  background: var(--negative);
}
.outcome-unverifiable {
  fill: #6e7075;
  background: #6e7075;
}
.outcome-pending {
  fill: #34363a;
  background: #34363a;
}
.forecast-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 28px;
  margin: 0;
}
.forecast-counts dt {
  color: var(--muted);
  font-size: 12.5px;
}
.forecast-counts dd {
  margin: 2px 0 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.018em;
}
.journal-entry {
  padding: 18px 0;
  border-top: 1px solid var(--line);
  font-size: 14px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.journal-entry:first-of-type {
  margin-top: 18px;
}
.journal-entry > .muted:first-child {
  font-size: 12px;
}
.journal h3 {
  margin: 2px 0 6px;
  font-size: 16px;
  font-weight: 650;
}
.journal-entry p {
  margin: 0 0 6px;
}
.journal-state {
  color: var(--yellow);
  font-weight: 600;
}
.reasoning {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 8px 20px;
  margin: 12px 0;
}
.reasoning dt {
  color: var(--faint);
  font-size: 12.5px;
}
.reasoning dd {
  margin: 0;
}
.reasoning ul {
  margin: 0;
  padding-left: 18px;
}

/* System */
.system {
  margin-top: 12px;
}
.system-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}
.system-grid p:not(.label) {
  margin: 4px 0 2px;
  font-size: 14px;
  font-weight: 600;
}
.system-grid small {
  display: block;
  font-size: 12px;
  line-height: 1.5;
}
.system form,
.system-grid a {
  display: inline-block;
  margin-top: 10px;
  font-size: 13px;
}
footer {
  margin-top: 32px;
  color: var(--faint);
  font-size: 12px;
}

/* Login and empty */
.login {
  max-width: 400px;
  margin: 10vh auto 0;
  padding: 32px;
}
.login h1,
.empty h1 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
}
.login label {
  display: block;
  margin-top: 24px;
  color: var(--muted);
  font-size: 13px;
}
.login input {
  display: block;
  width: 100%;
  padding: 13px 16px;
  margin: 8px 0 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
.login button {
  width: 100%;
  padding: 13px;
  border-radius: 12px;
  background: var(--yellow);
  color: var(--ink);
  font-weight: 700;
  font-size: 15px;
}
.empty {
  padding: 40px 28px;
}

@media (max-width: 1080px) {
  .hero,
  .board,
  .lower {
    grid-template-columns: minmax(0, 1fr);
  }
  .thinking {
    position: static;
  }
  .system-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 640px) {
  main {
    padding: 0 16px 32px;
  }
  .topbar {
    flex-wrap: wrap;
    gap: 12px;
    padding-top: 18px;
  }
  .source {
    display: none;
  }
  .source.demo-source {
    display: block;
    flex-basis: 100%;
    order: 2;
  }
  .topbar form {
    margin-left: auto;
  }
  .periods {
    order: 3;
    width: 100%;
  }
  .periods a {
    flex: 1;
    text-align: center;
    padding: 7px 0;
  }
  .status-strip {
    gap: 6px 14px;
    font-size: 12px;
  }
  .card {
    padding: 20px;
    border-radius: 18px;
  }
  .capital-head {
    flex-direction: column;
    gap: 2px;
  }
  .system-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }
  .flow-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  table.positions thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  table.positions tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 2px 12px;
    padding: 12px 0;
    border-top: 1px solid var(--line);
  }
  table.positions td {
    padding: 0;
    border: 0;
    white-space: nowrap;
  }
  table.positions td:first-child {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
  }
  table.positions td:first-child small {
    display: none;
  }
  table.positions td[data-label="Стоимость"] {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
    font-weight: 600;
  }
  table.positions td[data-label="Количество · цена"] {
    grid-column: 1;
    grid-row: 2;
    padding-left: 48px;
    color: var(--muted);
    font-size: 13px;
    text-align: left;
  }
  table.positions td[data-label="Количество · цена"] small {
    display: inline;
  }
  table.positions td[data-label="Количество · цена"] small::before {
    content: " · ";
  }
  table.positions .result-cell {
    grid-column: 2;
    grid-row: 2;
    font-size: 13px;
  }
  table.positions .result-cell small {
    display: inline;
    margin-left: 6px;
  }
  table.positions .share-cell {
    display: none;
  }
  .timeline li {
    grid-template-columns: 8px minmax(0, 1fr) auto;
  }
  .timeline-date {
    grid-column: 2;
    grid-row: 2;
    text-align: left;
    font-size: 12px;
  }
  .timeline-date small {
    display: inline;
    margin-left: 4px;
  }
  .timeline-amount {
    grid-column: 3;
    grid-row: 1 / span 2;
    min-width: 0;
  }
  .reasoning {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }
  .reasoning dd {
    margin-bottom: 8px;
  }
}

/* Compact journal and owner forms */
.journal-heading,
.journal-older > summary {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 4px 20px;
  align-items: baseline;
}
.journal-date {
  color: var(--muted);
  font-size: 12px;
}
.journal-older > summary {
  cursor: pointer;
}
.journal-latest > .journal-excerpt {
  max-width: 80ch;
  margin: 10px 0;
}
.journal-older > summary .journal-excerpt {
  grid-column: 2;
  color: var(--muted);
}
.journal-full > summary,
.system > summary,
.manual-assets summary {
  cursor: pointer;
  color: var(--yellow);
  font-weight: 600;
}
.journal-body {
  margin-top: 18px;
  max-width: 100ch;
}
.journal-original {
  margin-top: 12px;
}
.system[open] > summary {
  margin-bottom: 20px;
}
.manual-assets {
  margin-top: 12px;
}
.manual-assets form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}
.manual-assets label {
  color: var(--muted);
  font-size: 13px;
}
.manual-assets input,
.manual-assets select {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 12px;
  color: var(--text);
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
}
.manual-assets button {
  align-self: end;
}
.manual-asset small {
  color: var(--muted);
}
.notice {
  padding: 14px 18px;
  background: var(--surface-alt);
  border-left: 3px solid var(--yellow);
  border-radius: 8px;
}
@media (max-width: 600px) {
  .thinking-facts,
  .journal-heading,
  .journal-older > summary,
  .manual-assets form {
    grid-template-columns: minmax(0, 1fr);
  }
  .journal-older > summary .journal-excerpt {
    grid-column: 1;
  }
}
