/* /moex/screener/ (pipeline/pages/moexscr.py, js/moexscr.js): the visitor's own filter over the Moscow
   Exchange companies. A panel of sliders (the least value of a figure), two switches, ready-made filters,
   then the table. A figure that differs by span (growth over 1, 3 or 5 years) is in the HTML once a span,
   as <span data-p>; #ms-app[data-p] shows the picked one. The table is .stk-table of css/stocks.css. */
.ms-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 24px 0 12px; }
.ms-panel { padding: 20px 22px; margin: 0 0 14px; }
.ms-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px 30px; align-items: end; }
.ms-f { display: block; min-width: 0; cursor: pointer; }
.ms-f-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: 14.5px; line-height: 1.3; color: var(--ink-2); }
.ms-f-head small { font-size: 13px; color: var(--muted); white-space: nowrap; }
.ms-f output { flex: none; font: 500 14.5px/1.3 var(--font); color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ms-f.is-on .ms-f-head { color: var(--ink); }
.ms-f.is-on output { color: var(--ink); font-weight: 600; }
.ms-f input { display: block; width: 100%; margin: 9px 0 0; accent-color: var(--solid); cursor: pointer; }
:root[data-theme="dark"] .ms-f input, :root[data-theme="black"] .ms-f input,
:root[data-theme="dark"] .ms-check input, :root[data-theme="black"] .ms-check input { accent-color: var(--ink-2); }
.ms-checks { display: flex; flex-wrap: wrap; gap: 10px 26px; margin: 18px 0 0; padding-top: 16px; border-top: 1px solid var(--border); }
.ms-check { display: inline-flex; align-items: center; gap: 9px; font-size: 14.5px; color: var(--ink-2); cursor: pointer; }
.ms-check input { flex: none; width: 18px; height: 18px; margin: 0; accent-color: var(--solid); cursor: pointer; }
.ms-check input:checked + span { color: var(--ink); font-weight: 600; }

.ms-presets { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 0 0 16px; }
.ms-presets-label { font-size: 14.5px; color: var(--muted); }
.ms-presets-list { display: flex; flex-wrap: wrap; gap: 6px; }
.ms-presets .chip { background: var(--track); padding: 9px 13px; }
.ms-presets .chip[aria-pressed="true"] { background: var(--chip-active); }
.ms-reset { font: 500 14.5px/1 var(--font); color: var(--ink-2); background: none; border: 0; padding: 9px 6px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.ms-reset:hover { color: var(--ink); }
.ms-reset[hidden] { display: none; }

.ms-sub { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 24px; margin: 0 0 12px; }
.ms-sub .note { margin: 0; }
.ms-count { font-weight: 600; color: var(--ink); }
.ms-infl { max-width: 70ch; }

/* the picked span: growth cells, the line under their column heads and under the sliders, the inflation line */
.ms span[data-p] { display: none; }
.ms[data-p="1"] span[data-p="1"], .ms[data-p="3"] span[data-p="3"], .ms[data-p="5"] span[data-p="5"] { display: inline; }

.ms-wrap:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* 8px at the sides: with ten columns the widest table (German) is 1101px, inside the 1119px box of a 1280px window */
.ms-table th, .ms-table td { padding: 10px 8px; vertical-align: top; }
.ms-table td { min-width: 78px; }
.ms-table thead th { vertical-align: bottom; }
.ms-table th[aria-sort]::after { content: none; }   /* the arrow stands beside the button */
.ms-table thead button { display: block; margin-left: auto; font-weight: 600; color: var(--ink-2); }
.ms-table thead .ms-name button { margin-left: 0; }
.ms-table thead button[data-dir] { color: var(--ink); }
.ms-table thead button[data-dir="d"]::after { content: " ↓"; }
.ms-table thead button[data-dir="a"]::after { content: " ↑"; }
.ms-table thead small { display: block; margin: 3px 0 0; font-size: 12.5px; white-space: nowrap; }
.ms-table th[scope="row"] { text-align: left; white-space: normal; font-weight: 500; line-height: 1.25; min-width: 180px; max-width: 280px; }
.ms-table th[scope="row"] a { font-weight: 600; text-decoration: none; }
.ms-table th[scope="row"] a:hover { text-decoration: underline; }
.ms-table th[scope="row"] small { display: block; margin: 3px 0 0; font-size: 12.5px; letter-spacing: 0.03em; color: var(--muted); }
.ms-tag { display: inline-block; margin-left: 7px; padding: 1px 7px; border-radius: 999px; background: var(--track); color: var(--ink-2); font-size: 11.5px; letter-spacing: 0; }
.ms-table td { font-weight: 500; color: var(--ink); }
.ms-table .ms-up { color: var(--good); }
.ms-table .ms-neg, .ms-table .ms-dn { color: var(--bad); }
.ms-table .ms-flat { color: var(--ink-2); }
.ms-word { font-size: 13.5px; }
/* under a growth figure: the year it is counted from, where the span's own year has no report */
.ms-table td small { display: block; margin: 2px 0 0; font-size: 12.5px; font-weight: 500; color: var(--muted); }
.ms-table col.ms-on { background: var(--hover); }     /* the column the table is sorted by */
.ms-table tbody tr[hidden] { display: none; }

/* A wide screen holds the whole table: the page scrolls, and the head row stays under the site's menu
   (overflow: clip keeps the rounded corners without making a scroll box, which would hold the head row).
   From 1280px only: clip cuts what does not fit, and the widest table (German, 1076px with its long
   column heads) fits its box from there on, also under the site's 110% zoom of wide screens. */
@supports (overflow: clip) {
  @media (min-width: 1280px) {
    .ms-wrap { overflow: clip; }
    .ms-table thead th { top: 64px; }
  }
}
/* A narrower one: the table scrolls in its own box, both ways; the head row and the names stay in place. */
@media (max-width: 1279.98px) {
  .ms-wrap { overflow: auto; max-height: calc(100vh - 84px); max-height: calc(100dvh - 84px); overscroll-behavior-x: contain; }
  .ms-table th, .ms-table td { padding: 9px 8px; }
  .ms-table th[scope="row"] { min-width: 150px; }
  .ms-table thead th { z-index: 2; }
  .ms-table thead th:first-child { position: sticky; left: 0; z-index: 3; }
  .ms-table th[scope="row"] { position: sticky; left: 0; z-index: 1; background: var(--surface); }
  .ms-table thead th:first-child, .ms-table th[scope="row"] { box-shadow: 1px 0 0 var(--border); }   /* the edge the figures slide under */
  .ms-table tbody tr:hover th[scope="row"] { background: var(--hover); }
}
@media (max-width: 640px) {
  .ms-bar { margin-top: 18px; }
  .ms-panel { padding: 16px 16px; }
  .ms-filters { grid-template-columns: 1fr; gap: 14px; }
  .ms-table th, .ms-table td { padding: 8px 8px; }
  .ms-table th[scope="row"] { min-width: 128px; max-width: 150px; font-size: 13.5px; }
}
