/* AIDI-20 — язык витрины getnyquist.com (сетка 30px, шапка-капсула, Inter Tight
   + JetBrains Mono, один синий акцент), но плотная справка, а не витрина. */

:root {
  --bg: #F6F6F4;
  --bg2: #ECECE7;
  --panel: #FFFFFF;
  --ink: #0B0E14;
  --ink2: #353842;
  --ink3: #696C75;
  --line: #E2E2DB;
  --line2: #D0D0C7;
  --hair: rgba(11, 14, 20, .10);
  --grid: rgba(11, 14, 20, .045);
  --tint: #EEF2FF;
  --accent: #2D6BFF;
  --up: #B5402F;
  --down: #1F6B3E;
  --warn: #795D1A;
  --hy: #8A8C90;
  --shade: rgba(121, 93, 26, .09);
  --btn: #0B0E14;
  --btn-ink: #FFFFFF;
  --sans: 'Inter Tight', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0C0D10;
    --bg2: #1A1C21;
    --panel: #14161A;
    --ink: #F2F0EA;
    --ink2: #C8C7C1;
    --ink3: #8F9093;
    --line: #23252A;
    --line2: #34363C;
    --hair: rgba(242, 240, 234, .13);
    --grid: rgba(242, 240, 234, .05);
    --tint: #121B3D;
    --accent: #6E9BFF;
    --up: #E58C7C;
    --down: #4CB57B;
    --warn: #D4A04C;
    --hy: #7A7C81;
    --shade: rgba(212, 160, 76, .11);
    --btn: #F2F0EA;
    --btn-ink: #0B0E14;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; }
body {
  margin: 0;
  background-color: var(--bg);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 30px 30px;
  color: var(--ink);
  font: 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
a:hover { color: var(--ink); }
h1, h2 { margin: 0; }
h2 { font-size: 15px; font-weight: 600; }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.cap { font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; }
.faint { color: var(--ink3); }
.accent { color: var(--accent); }
.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--ink3); }
.warn { color: var(--warn); }
.r { text-align: right; }
.strong { font-weight: 600; }
.sub { display: block; font-size: 11.5px; color: var(--ink3); font-weight: 400; }

.wrap { max-width: 1280px; margin: 0 auto; padding: 0 16px; }

/* шапка-капсула */
header.site { position: sticky; top: 0; z-index: 10; padding: 14px 16px 0; }
.pill {
  max-width: 1280px; margin: 0 auto; min-height: 52px; padding: 6px 8px 6px 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  border: 1px solid var(--line); border-radius: 999px; background: var(--bg);
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font-weight: 600; }
.brand img { border-radius: 3px; }
.pill nav { display: flex; gap: 20px; flex-wrap: wrap; font-size: 13px; }
.pill nav a { color: var(--ink); text-decoration: none; }
.pill nav a:hover { color: var(--accent); }
.btn {
  display: inline-flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 6px 0 16px;
  border-radius: 999px; background: var(--btn); color: var(--btn-ink); text-decoration: none; font-size: 13.5px; font-weight: 500;
}
.btn:hover { color: var(--btn-ink); opacity: .9; }
.btn-arrow {
  width: 28px; height: 28px; border-radius: 999px; border: 1px solid currentColor;
  display: inline-flex; align-items: center; justify-content: center; font-size: 11px;
}

main.wrap { display: flex; flex-direction: column; gap: 16px; padding-top: 28px; padding-bottom: 48px; }

/* значение индекса */
.value { display: flex; flex-direction: column; gap: 8px; padding: 6px 0 2px; }
.value h1 { font-size: 15px; font-weight: 500; color: var(--ink2); }
.big { display: flex; align-items: baseline; gap: 10px; }
.big #netLevel { font-size: 64px; font-weight: 600; letter-spacing: -.04em; line-height: 1; }
.big .unit { font-size: 18px; color: var(--ink3); }
.headline { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; }
.lede { margin: 2px 0 0; max-width: 78ch; font-size: 13.5px; color: var(--ink2); }
.runline { font-size: 12px; color: var(--ink3); }
.notice {
  margin: 4px 0 0; padding: 10px 12px; max-width: 90ch; font-size: 13px;
  border: 1px solid var(--line2); border-radius: 10px; background: var(--panel); color: var(--warn);
}

/* панели */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.panel-head { padding: 12px 16px; border-bottom: 1px solid var(--hair); }
.panel-head .sub { margin-top: 2px; font-size: 12px; }
.panel-head.row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.panel-head.row .sub { margin: 0; display: inline; }
.foot { margin: 0; padding: 8px 16px 12px; border-top: 1px solid var(--hair); font-size: 12px; color: var(--ink3); }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 520px), 1fr)); gap: 16px; }
.scroll { overflow-x: auto; }

/* таблицы */
table { width: 100%; border-collapse: collapse; }
th {
  padding: 9px 10px; border-bottom: 1px solid var(--hair); text-align: left; vertical-align: bottom; white-space: nowrap;
  font: 400 10px/1.3 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--ink3);
}
td { padding: 8px 10px; border-bottom: 1px solid var(--hair); font-size: 13px; white-space: nowrap; vertical-align: top; }
th:first-child, td:first-child { padding-left: 16px; }
th:last-child, td:last-child { padding-right: 16px; }
tbody tr:last-child td { border-bottom: 0; }
td.lvl { font-size: 18px; font-weight: 600; }
td.lvl-sm, td.strong-cell { font-weight: 600; }
tr.picked td { background: var(--tint); }
tr.muted td { color: var(--ink3); }
tfoot td { border-top: 1px solid var(--ink); border-bottom: 0; font-weight: 600; }
.chip {
  min-height: 30px; padding: 0 12px; border: 1px solid var(--line2); border-radius: 999px;
  background: transparent; color: var(--ink2); font-size: 12px;
}
.chip[aria-pressed="true"] { background: var(--btn); color: var(--btn-ink); border-color: var(--btn); }

/* расчётная база: без горизонтальной прокрутки на десктопе */
.base-list {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 520px), 1fr)); column-gap: 32px;
  padding: 4px 16px 12px; border-bottom: 1px solid var(--hair);
}
.kv { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--hair); font-size: 13px; }
.kv .k { color: var(--ink3); }
.fit { overflow-x: visible; }
table.base th, table.base td { padding: 7px 6px; }
table.base th:first-child, table.base td:first-child { padding-left: 16px; }
table.base td { font-size: 12.5px; }
table.base td .sub { white-space: normal; }
.flag { display: block; max-width: 220px; font-size: 11px; color: var(--warn); white-space: normal; }
@media (max-width: 1100px) { .fit { overflow-x: auto; } }

/* вклады */
.drows { padding: 6px 16px 4px; }
.drow {
  display: grid; grid-template-columns: 64px minmax(0, 1fr) 64px 48px; gap: 10px; align-items: center;
  padding: 5px 0; border-bottom: 1px solid var(--hair); font-size: 13px;
}
.drow.movers { grid-template-columns: 64px minmax(0, 1fr) 64px 104px; }
.drow .faint { font-size: 12px; }
.bar { position: relative; display: block; height: 10px; background: var(--bg2); border-radius: 2px; overflow: hidden; }
.bar-fill { position: absolute; top: 0; bottom: 0; left: 0; }
.bar-fill.accent { background: var(--accent); }
.bar-fill.up-fill { background: var(--up); }
.bar-fill.down-fill { background: var(--down); }
.bar .axis { position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: var(--line2); z-index: 1; }
.rest { padding: 6px 16px 12px; font-size: 12px; color: var(--ink3); }

/* график */
.bar-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 16px; border-bottom: 1px solid var(--hair); }
.seg { display: inline-flex; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; flex-wrap: wrap; }
.seg-btn {
  min-height: 32px; padding: 0 12px; border: 0; border-radius: 999px;
  background: transparent; color: var(--ink2); font-size: 12.5px; font-weight: 500;
}
.seg-btn[aria-pressed="true"] { background: var(--btn); color: var(--btn-ink); }
.legend-row { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 16px 0; font-size: 12.5px; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; color: var(--ink2); }
.key { display: inline-flex; align-items: center; gap: 6px; }
.swatch { display: inline-block; width: 16px; height: 2px; }
.sw-raw { background: var(--accent); }
.sw-hy { background: var(--hy); }
.sw-net { background: var(--up); }
.sw-shade { width: 12px; height: 10px; background: var(--shade); }
.span { color: var(--ink3); }
.span .sum { margin-left: 8px; }
.chart { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 8px; padding: 14px 16px 8px; }
.yaxis, .plot { position: relative; height: 304px; }
.tick { position: absolute; font-size: 10.5px; color: var(--ink3); white-space: nowrap; pointer-events: none; }
.yaxis .tick { right: 0; transform: translateY(-50%); }
.xaxis .tick { top: 286px; transform: translateX(-50%); }
#chartSvg { display: block; width: 100%; height: 280px; overflow: visible; }
#chartSvg .grid { stroke: var(--hair); stroke-width: 1; }
#chartSvg .grid.zero { stroke: var(--ink3); stroke-dasharray: 3 4; }
#chartSvg .shade { fill: var(--shade); }
#chartSvg .ln { fill: none; stroke-width: 2; stroke-linejoin: round; }
#chartSvg .ln-raw { stroke: var(--accent); }
#chartSvg .ln-hy { stroke: var(--hy); stroke-width: 1.5; }
#chartSvg .ln-net { stroke: var(--up); }
#chartSvg .cursor { stroke: var(--ink3); stroke-width: 1; stroke-dasharray: 2 3; }
.dots { position: absolute; inset: 0 0 auto 0; height: 280px; pointer-events: none; }
.dot {
  position: absolute; width: 9px; height: 9px; border-radius: 999px; border: 2px solid var(--panel);
  transform: translate(-50%, -50%); box-sizing: content-box;
}
.overlay { position: absolute; left: 0; right: 0; top: 0; height: 280px; cursor: crosshair; touch-action: pan-y; }
.tip {
  position: absolute; top: 8px; left: var(--x); margin-left: 12px; min-width: 180px; padding: 8px 10px;
  background: var(--panel); border: 1px solid var(--line2); border-radius: 8px; font-size: 12px; pointer-events: none;
}
.tip.flip { left: auto; right: calc(100% - var(--x)); margin-left: 0; margin-right: 12px; }
.tip-date { color: var(--ink); font-weight: 500; margin-bottom: 4px; }
.tip-row { display: flex; justify-content: space-between; gap: 18px; }
.tip-row .k { color: var(--ink3); }
.tip-row .raw { color: var(--accent); }
.tip-row .net { color: var(--up); }

/* методика */
.kvs { padding: 4px 16px 10px; }
.caveat { padding: 8px 0; border-bottom: 1px solid var(--hair); font-size: 13px; color: var(--ink2); }
.caveat .cap { display: block; margin-bottom: 2px; }
.caveat p { margin: 0; }
.kvs > :last-child { border-bottom: 0; }

footer.site { border-top: 1px solid var(--hair); }
.foot-row { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-top: 18px; padding-bottom: 28px; font-size: 12px; color: var(--ink3); }

@media (max-width: 720px) {
  .pill nav { display: none; }
  .big #netLevel { font-size: 48px; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .drow.movers { grid-template-columns: 56px minmax(0, 1fr) 56px; }
  .drow.movers > :last-child { display: none; }
}


/* обозначения с индексом в заголовках не переводить в верхний регистр */
th.sym { text-transform: none; letter-spacing: 0; font-size: 11.5px; }
sub { font-size: .75em; line-height: 0; }

[hidden] { display: none; }
