/* «Московка» — дизайн-система сборной Москвы по ИИ: токены, шрифты и компоненты ms-*.
   Источник: design/moskovka-handoff (tokens/moskovka.css + design-system/components/bundle.css).
   Файл собран из пакета без изменения значений; правки платформы — в platform.css.
   Шрифты «Конструктива» (вариант 18 шрифтовой лаборатории, выбран 31.10.2026): Dela Gothic One —
   знак и заголовки капсом, Golos Text — интерфейс, Caveat — роспись, JetBrains Mono — код.
   Лицензии: static/moskovka-fonts.LICENSE.txt, Golos — static/platform-fonts.LICENSE.txt. */

@font-face { font-family: "Dela Gothic One"; src: url("/static/font-dela-gothic-one.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Golos Text"; src: url("/static/font-golos.woff2") format("woff2"); font-weight: 400 900; font-style: normal; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("/static/font-jetbrains-mono.woff2") format("woff2"); font-weight: 400 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Caveat"; src: url("/static/font-caveat.woff2") format("woff2"); font-weight: 400 700; font-style: normal; font-display: swap; }

:root, [data-theme="dark"] {
  --moskovka-900: #3A0B19;
  --moskovka-800: #4A0F20;
  --moskovka-700: #7A1C34;
  --moskovka-600: #93233F;
  --moskovka-400: #C43B5E;
  --moskovka-300: #E07391;
  --gold-thread: #CDB68A;
  --cream: #F2EBDD;
  --tee: #D9CFBF;

  --bg: #110C0D;
  --surface: #1A1315;
  --surface-2: #241A1D;
  --line: #3A2A2F;
  --line-strong: #6E5A60;
  --text: #F2EBDD;
  --text-muted: #BDB1A8;
  --text-subtle: #8F837D;
  --accent: #7A1C34;
  --accent-hover: #93233F;
  --on-accent: #F2EBDD;
  --accent-ink: #E07391;
  --accent-subtle: #3A0B19;
  --gold: #CDB68A;
  --focus: #F2EBDD;
  --success: #6FC28B;
  --warning: #E8B04A;
  --danger: #FF7A5C;
  --data-1: #E07391;
  --data-2: #8FB3D9;
  --data-3: #F2EBDD;
  --data-4: #9DBF9E;
  --data-muted: #5A4A4F;
  --varsity-fill: #F2EBDD;
  --varsity-shadow: #4A0F20;
  --stitch: #F2EBDD66;
  --stitch-gold: #CDB68A99;
  --stitch-line: #F2EBDD66;
  --scrim: #110C0DB3;
  /* поле точек hero (hero_spine.js): фон, шум, ядра букв, граница кластеров, свежий штрих, подписи круга, «Москва», линия обхода */
  --hero-bg: #1A1315; --hero-noise: #5A4A4F; --hero-core: #F2EBDD; --hero-edge: #E07391;
  --hero-live: #BDB1A8; --hero-subtle: #8F837D; --hero-script: #CDB68A; --hero-scan: #F2EBDD29;

  --font-varsity: "Dela Gothic One", "Golos Text", sans-serif; --varsity-weight: 400;
  --font-script: "Caveat", cursive; --script-weight: 700; --script-scale: 1;
  --font-ui: "Golos Text", system-ui, sans-serif;
  --font-head: "Dela Gothic One", "Golos Text", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-6: 24px;
  --space-8: 32px; --space-12: 48px; --space-16: 64px; --space-24: 96px;
  --radius-s: 0; --radius-m: 0; --radius-l: 0; --radius-pill: 0;
  --shadow-pop: 0 16px 40px -8px #000000CC, 0 2px 8px #00000066;
  --control-h: 40px; --control-h-touch: 44px;
  --content-max: 1200px; --page-gutter: 24px; --page-gutter-mobile: 16px; --self-stripe: 3px;
  --duration-fast: 150ms; --duration-base: 200ms; --ease-out: cubic-bezier(0, 0, 0.2, 1);
}

[data-theme="light"] {
  --bg: #F6F1E8; --surface: #FFFDF9; --surface-2: #EFE7DA; --line: #E0D5C6; --line-strong: #8C7B70;
  --text: #1E1416; --text-muted: #5E5157; --text-subtle: #7D6F72;
  --accent-ink: #7A1C34; --accent-subtle: #EFE7DA; --gold: #7C6230; --focus: #7A1C34;
  --success: #2F7D4F; --warning: #93650F; --danger: #B8401F;
  --varsity-fill: #7A1C34; --varsity-shadow: #D9CFBF; --stitch-line: #8C7B70; --scrim: #1E141673;
  --shadow-pop: 0 16px 40px -12px #1E141633, 0 2px 8px #1E14161A;
  /* светлое поле: точки букв бордовые, как варсити знака в светлой теме, «Москва» — золото светлой темы */
  --hero-bg: #FFFDF9; --hero-noise: #CDBFB2; --hero-core: #7A1C34; --hero-edge: #C43B5E;
  --hero-live: #8C7B70; --hero-subtle: #A6978C; --hero-script: #7C6230; --hero-scan: #1E14161F;
}

/* ── мелочи, которых нет в компонентах системы: степпер, ползунок, раскрывашка ── */
.mk-step {
  width: 36px; height: 38px; padding: 0; border: 0; border-radius: 5px;
  background: transparent; color: var(--text); cursor: pointer;
  font: 400 16px/1 var(--font-mono);
  transition: background-color var(--duration-fast) var(--ease-out);
}
.mk-step:hover { background: var(--surface-2); }
.mk-step:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.mk-step:disabled { color: var(--text-subtle); background: transparent; cursor: not-allowed; }

.mk-range { -webkit-appearance: none; appearance: none; width: 100%; min-width: 120px; height: 40px; margin: 0; background: transparent; cursor: pointer; }
.mk-range::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: var(--line-strong); }
.mk-range::-moz-range-track { height: 4px; border-radius: 2px; background: var(--line-strong); }
.mk-range::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -7px; border-radius: 50%; border: 2px solid var(--bg); background: var(--accent-ink); }
.mk-range::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--bg); background: var(--accent-ink); }
.mk-range:focus-visible { outline: none; }
.mk-range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--focus); }
.mk-range:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--focus); }

.mk-details > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  height: 44px; padding: 0 12px; list-style: none; cursor: pointer;
  border: 1px solid var(--line-strong); border-radius: var(--radius-s);
  color: var(--text); font: 600 14px/20px var(--font-ui);
}
.mk-details > summary::-webkit-details-marker { display: none; }
.mk-details > summary:hover { background: var(--surface-2); }
.mk-details > summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.mk-details[open] > summary .mk-chev { transform: rotate(180deg); }

.mk-link { color: var(--accent-ink); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; border-radius: 2px; }
.mk-link:hover { color: var(--text); }
.mk-link:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ── знак: «Москва» ниже и отдельнее от «СБОРНАЯ» ──
   Поправка поверх Wordmark системы (перенести в саму систему): роспись уходит под слово
   и только хвостом задевает низ букв; в шапке (size s) роспись крупнее, иначе её не прочесть. */
.ms-wordmark.ms-wordmark { padding-bottom: calc(var(--wm) * 0.44); }
.ms-wordmark .ms-wordmark__script { top: calc(var(--wm) * 0.62); left: 26%; font-size: calc(var(--wm) * 0.66); -webkit-text-stroke-width: calc(var(--wm) * 0.09); }
.ms-wordmark--s.ms-wordmark { padding-bottom: calc(var(--wm) * 0.5); }
.ms-wordmark--s.ms-wordmark .ms-wordmark__script { top: calc(var(--wm) * 0.6); left: 24%; font-size: calc(var(--wm) * 0.74); }

/* ── экран задачи ── */
.mk-wrap { max-width: 1248px; margin: 0 auto; padding-left: 24px; padding-right: 24px; box-sizing: border-box; }
@media (max-width: 560px) { .mk-wrap { padding-left: 16px; padding-right: 16px; } }

/* сабмиты с датой: колонка времени шире, чем «22:41» в системе */
@media (min-width: 561px) {
  .mk-subs-dated .ms-subs__head, .mk-subs-dated .ms-sub { grid-template-columns: 40px 104px minmax(0, 1fr) 136px 120px; }
}

/* фрагмент кода */
.mk-code { margin: 0; padding: 16px 0; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--bg); font: 400 14px/22px var(--font-mono); color: var(--text); }
.mk-code code { display: block; min-width: max-content; }
.mk-code .ln { display: inline-block; width: 40px; padding-right: 16px; box-sizing: border-box; text-align: right; color: var(--text-subtle); user-select: none; }
.mk-kw { color: var(--accent-ink); }
.mk-str { color: var(--data-4); }

/* формула в стиле LaTeX (в продакшене — KaTeX) */
.mk-math { font-family: "STIX Two Text", "Times New Roman", serif; font-feature-settings: "lnum"; white-space: nowrap; }
.mk-math i { font-style: italic; padding-right: 0.06em; }
.mk-ol { text-decoration: overline; text-decoration-thickness: 1px; text-underline-offset: 0; }

/* карта заданий летучки */
.mk-qcell { width: 40px; height: 40px; padding: 0; border: 1px solid var(--line-strong); border-radius: var(--radius-s); background: var(--bg); color: var(--text-muted); font: 400 14px/1 var(--font-mono); cursor: pointer; transition: background-color var(--duration-fast) var(--ease-out); }
.mk-qcell:hover { background: var(--surface-2); color: var(--text); }
.mk-qcell:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.mk-qcell.is-done { border-color: transparent; background: var(--surface-2); color: var(--text); }
.mk-qcell.is-current { border-color: transparent; background: var(--accent); color: var(--on-accent); font-weight: 600; }
.mk-qcell.is-current:hover { background: var(--accent-hover); }
@media (max-width: 560px) { .mk-qcell { width: 44px; height: 44px; } }

@media (prefers-reduced-motion: reduce) {
  .mk-step, .mk-qcell { transition: none; }
}


/* «Московка» — стили компонентов. Все значения — из tokens.css (--bg, --accent, --space-4 …).
   Классы ms-* принадлежат системе. Модификаторы is-hover / is-focus только для витрины состояний. */

:root, [data-theme="dark"] { color-scheme: dark; }
[data-theme="light"] { color-scheme: light; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 24px;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* цифры интерфейса — Golos с табличными цифрами; моно — только код и колонки данных */
.ms-num { font-family: var(--font-ui); font-variant-numeric: tabular-nums lining-nums; }
.ms-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.ms-icon { flex: none; display: inline-block; vertical-align: -0.15em; }

/* ── фактура ткани: шум ~3 % на крупных бордовых плашках ── */
.ms-fabric {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.07'/%3E%3C/svg%3E");
}

/* ── варсити: Dela Gothic One, прописные, вышитая тень 3 px + тонкая обводка ── */
.ms-varsity {
  --vs: var(--varsity-shadow);
  --o: 1px;
  --d: 3px;
  font-family: var(--font-varsity);
  font-weight: var(--varsity-weight, 900);
  text-transform: uppercase;
  letter-spacing: -0.02em;
  color: var(--varsity-fill);
  text-shadow:
    calc(-1 * var(--o)) calc(-1 * var(--o)) 0 var(--vs), var(--o) calc(-1 * var(--o)) 0 var(--vs),
    calc(-1 * var(--o)) var(--o) 0 var(--vs), var(--o) var(--o) 0 var(--vs),
    calc(var(--d) / 3) calc(var(--d) / 3) 0 var(--vs), calc(var(--d) * 2 / 3) calc(var(--d) * 2 / 3) 0 var(--vs),
    var(--d) var(--d) 0 var(--vs), calc(var(--d) + var(--o)) var(--d) 0 var(--vs),
    var(--d) calc(var(--d) + var(--o)) 0 var(--vs), calc(var(--d) + var(--o)) calc(var(--d) + var(--o)) 0 var(--vs);
}

/* ── «Конструктив»: плашка раздела (бордо, наклон −2°), малый заголовок капсом, бордовая полоса над карточкой ── */
.ms-plate {
  display: block;
  width: fit-content;
  max-width: 100%;
  padding: 6px 14px 4px;
  background: var(--accent);
  color: var(--on-accent);
  font: 400 22px / 28px var(--font-head);
  letter-spacing: 0.01em;
  text-transform: uppercase;
  transform: rotate(-2deg);
  transform-origin: 0 100%;
}
.ms-head-s { font: 400 18px / 24px var(--font-head); letter-spacing: 0.01em; text-transform: uppercase; }
/* двойной класс: карточки задают border сокращённой записью и иначе перебили бы полосу */
.ms-strip.ms-strip { border-top: 8px solid var(--accent); }
@media (max-width: 640px) { .ms-plate { font-size: 18px; line-height: 24px; } }

/* ── строчка: пунктир 1 px, штрих 4, пробел 3 ── */
.ms-stitch {
  position: absolute;
  top: var(--si, 4px);
  left: var(--si, 4px);
  width: calc(100% - 2 * var(--si, 4px));
  height: calc(100% - 2 * var(--si, 4px));
  overflow: visible;
  pointer-events: none;
}
.ms-stitch rect {
  x: 0.5px;
  y: 0.5px;
  width: calc(100% - 1px);
  height: calc(100% - 1px);
  fill: none;
  stroke: var(--stitch);
  stroke-width: 1px;
  stroke-dasharray: 4 3;
}
.ms-stitch--gold rect { stroke: var(--stitch-gold); }
.ms-stitch--line rect { stroke: var(--stitch-line); }
.ms-stitch--ink rect { stroke: var(--accent-ink); }
.ms-stitch--thick rect { stroke-width: 2px; stroke-dasharray: 10 7; x: 1px; y: 1px; width: calc(100% - 2px); height: calc(100% - 2px); }
.ms-stitch--card rect { stroke-width: 3px; stroke-dasharray: 14 10; x: 1.5px; y: 1.5px; width: calc(100% - 3px); height: calc(100% - 3px); }

/* ── знак ── */
.ms-wordmark {
  --wm: 48px;
  position: relative;
  display: inline-block;
  padding: 0 0.12em calc(var(--wm) * 0.3) 0;
  line-height: 1;
  white-space: nowrap;
}
.ms-wordmark--s { --wm: 22px; }
.ms-wordmark--l { --wm: 96px; }
.ms-wordmark--s .ms-varsity { --d: 2px; }
.ms-wordmark__varsity { display: block; font-size: var(--wm); line-height: 0.92; }
.ms-wordmark__script {
  position: absolute;
  left: 29%;
  top: 44%;
  font-family: var(--font-script);
  font-weight: var(--script-weight, 400);
  font-size: calc(var(--wm) * 0.8);
  line-height: 1;
  color: var(--gold);
  transform: rotate(-8deg);
  transform-origin: 0 50%;
  -webkit-text-stroke: calc(var(--wm) * 0.07) var(--bg);
  paint-order: stroke fill;
}

.ms-monogram {
  --mg: 32px;
  position: relative;
  display: inline-grid;
  place-items: center;
  width: var(--mg);
  height: var(--mg);
  flex: none;
  border-radius: var(--radius-s);
  background-color: var(--accent);
  color: var(--on-accent);
  font: 800 calc(var(--mg) * 0.34) / 1 var(--font-ui);
  letter-spacing: -0.02em;
}
.ms-monogram--m { --mg: 48px; border-radius: var(--radius-m); }
.ms-monogram--l { --mg: 96px; border-radius: var(--radius-m); }

/* ── клавиши ── */
.ms-kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  box-sizing: border-box;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-s);
  background: var(--surface-2);
  color: var(--text-muted);
  font: 500 12px / 1 var(--font-mono);
}
.ms-kbd + .ms-kbd { margin-left: 2px; }

/* ── кнопки ── */
.ms-btn {
  --h: var(--control-h, 40px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: var(--h);
  padding: 0 var(--space-4);
  box-sizing: border-box;
  border: 1px solid transparent;
  border-radius: var(--radius-s);
  font: 700 14px / 20px var(--font-ui);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--ease-out), border-color var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out);
}
.ms-btn--lg { --h: var(--control-h-touch, 44px); padding: 0 20px; font-size: 16px; line-height: 24px; }
.ms-btn--block { display: flex; width: 100%; }
.ms-btn__kbd { display: inline-flex; margin-right: -6px; }

.ms-btn--primary { background-color: var(--accent); color: var(--on-accent); }
.ms-btn--primary:hover, .ms-btn--primary.is-hover { background-color: var(--accent-hover); }
.ms-btn--primary .ms-kbd { border-color: var(--stitch); background: transparent; color: var(--on-accent); }

.ms-btn--secondary { background-color: transparent; border-color: var(--line-strong); color: var(--text); }
.ms-btn--secondary:hover, .ms-btn--secondary.is-hover { background-color: var(--surface-2); border-color: var(--text-subtle); }

.ms-btn--ghost { padding: 0 var(--space-3); background-color: transparent; color: var(--accent-ink); }
.ms-btn--ghost:hover, .ms-btn--ghost.is-hover { background-color: var(--surface-2); }

.ms-btn--on-accent { background-color: transparent; border-color: var(--stitch); color: var(--on-accent); }
.ms-btn--on-accent:hover, .ms-btn--on-accent.is-hover { background-color: var(--moskovka-800); }

.ms-btn:focus-visible, .ms-btn.is-focus { outline: 2px solid var(--focus); outline-offset: 2px; }
.ms-btn:disabled, .ms-btn.is-disabled, .ms-btn[aria-disabled="true"] {
  background-color: var(--surface-2);
  border-color: transparent;
  color: var(--text-subtle);
  cursor: not-allowed;
}
.ms-btn--ghost:disabled, .ms-btn--ghost.is-disabled { background-color: transparent; }
.ms-btn:disabled .ms-kbd, .ms-btn.is-disabled .ms-kbd { border-color: var(--line); background: transparent; color: var(--text-subtle); }

.ms-iconbtn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: var(--radius-s);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out);
}
.ms-iconbtn:hover, .ms-iconbtn.is-hover { background-color: var(--surface-2); color: var(--text); }
.ms-iconbtn:focus-visible, .ms-iconbtn.is-focus { outline: 2px solid var(--focus); outline-offset: 2px; }
.ms-iconbtn:disabled { color: var(--text-subtle); background: transparent; cursor: not-allowed; }
.ms-iconbtn--on-accent { color: var(--on-accent); }
.ms-iconbtn--on-accent:hover, .ms-iconbtn--on-accent.is-hover { background-color: var(--moskovka-800); color: var(--on-accent); }

/* ── шапка ── */
.ms-header {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  height: 64px;
  padding: 0 var(--page-gutter, 24px);
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.ms-header__brand { display: inline-flex; border-radius: var(--radius-s); text-decoration: none; }
.ms-header__brand:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.ms-header__nav { min-width: 0; }
.ms-header__nav ul { display: flex; gap: var(--space-1); margin: 0; padding: 4px; list-style: none; }
.ms-navlink {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 var(--space-3);
  border-radius: 999px; /* пилюли только у главной навигации: --radius-pill в «Конструктиве» = 0 */
  color: var(--text-muted);
  font: 600 14px / 20px var(--font-ui);
  text-decoration: none;
  white-space: nowrap;
  transition: background-color var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out);
}
.ms-navlink:hover, .ms-navlink.is-hover { background-color: var(--surface-2); color: var(--text); }
.ms-navlink.is-active { background-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.ms-navlink.is-active:hover, .ms-navlink.is-active.is-hover { background-color: var(--accent-hover); }
.ms-navlink:focus-visible, .ms-navlink.is-focus { outline: 2px solid var(--focus); outline-offset: 2px; }
.ms-navlink[aria-disabled="true"], .ms-navlink.is-disabled { background: transparent; color: var(--text-subtle); cursor: not-allowed; }
.ms-header__end { display: flex; align-items: center; gap: var(--space-3); margin-left: auto; }
.ms-cmdk {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  height: 32px;
  padding: 0 6px 0 var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  background: var(--surface);
  color: var(--text-muted);
  font: 500 14px / 20px var(--font-ui);
  cursor: pointer;
  transition: border-color var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out);
}
.ms-cmdk:hover, .ms-cmdk.is-hover { border-color: var(--line-strong); color: var(--text); }
.ms-cmdk:focus-visible, .ms-cmdk.is-focus { outline: 2px solid var(--focus); outline-offset: 2px; }
.ms-avatar {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text);
  font: 600 12px / 1 var(--font-ui);
}

/* ── поле ввода ── */
.ms-field { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.ms-field__label { font: 500 14px / 20px var(--font-ui); color: var(--text-muted); }
.ms-field__control {
  display: flex;
  align-items: center;
  height: var(--control-h, 40px);
  padding: 0 var(--space-3);
  box-sizing: border-box;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-s);
  background: var(--bg);
  transition: border-color var(--duration-fast) var(--ease-out);
}
.ms-field__control:hover, .ms-field__control.is-hover { border-color: var(--text-subtle); }
.ms-field__control:focus-within, .ms-field__control.is-focus { outline: 2px solid var(--focus); outline-offset: 2px; }
.ms-field__input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font: 400 16px / 24px var(--font-ui);
}
.ms-field__input.ms-num { font-family: var(--font-mono); font-size: 14px; }
.ms-field__input::placeholder { color: var(--text-subtle); opacity: 1; }
.ms-field__suffix { margin-left: var(--space-2); color: var(--text-muted); font: 400 12px / 16px var(--font-mono); white-space: nowrap; }
.ms-field__hint { margin: 0; color: var(--text-muted); font: 400 12px / 16px var(--font-ui); }
.ms-field__error { display: flex; gap: var(--space-1); align-items: flex-start; margin: 0; color: var(--danger); font: 500 12px / 16px var(--font-ui); }
.ms-field__error .ms-icon { margin-top: 1px; }
.ms-field.is-invalid .ms-field__control { border-color: var(--danger); }
.ms-field.is-disabled .ms-field__label { color: var(--text-subtle); }
.ms-field.is-disabled .ms-field__control { border-color: var(--line); background: var(--surface-2); }
.ms-field.is-disabled .ms-field__input { color: var(--text-subtle); cursor: not-allowed; }

/* ── сегменты ── */
.ms-seg {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
}
.ms-seg__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-muted);
  font: 500 14px / 20px var(--font-ui);
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out);
}
.ms-seg--sm .ms-seg__item { height: 26px; padding: 0 10px; font-size: 12px; line-height: 16px; }
.ms-seg__item:hover, .ms-seg__item.is-hover { background-color: var(--line); color: var(--text); }
.ms-seg__item.is-selected { background-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.ms-seg__item.is-selected:hover, .ms-seg__item.is-selected.is-hover { background-color: var(--accent-hover); }
.ms-seg__item:focus-visible, .ms-seg__item.is-focus { outline: 2px solid var(--focus); outline-offset: 2px; }
.ms-seg__item:disabled, .ms-seg__item.is-disabled { background: transparent; color: var(--text-subtle); cursor: not-allowed; }
.ms-seg.is-disabled .ms-seg__item.is-selected { background-color: var(--line); color: var(--text-subtle); }

/* ── вкладки ── */
.ms-tabs {
  display: flex;
  gap: var(--space-6);
  margin: -4px -4px 0;
  padding: 4px 4px 0;
  overflow-x: auto;
  box-shadow: inset 0 -1px 0 var(--line);
}
.ms-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  height: 40px;
  padding: 0 2px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font: 500 14px / 20px var(--font-ui);
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: color var(--duration-fast) var(--ease-out);
}
.ms-tab::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; border-radius: 2px 2px 0 0; background: transparent; }
.ms-tab:hover, .ms-tab.is-hover { color: var(--text); }
.ms-tab:hover::after, .ms-tab.is-hover::after { background: var(--line-strong); }
.ms-tab.is-selected { color: var(--text); font-weight: 600; }
.ms-tab.is-selected::after { background: var(--accent-ink); }
.ms-tab:focus-visible, .ms-tab.is-focus { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.ms-tab:disabled, .ms-tab.is-disabled { color: var(--text-subtle); cursor: not-allowed; }
.ms-tab:disabled::after { background: transparent; }
.ms-tab__count { padding: 0 6px; border-radius: var(--radius-pill); background: var(--surface-2); color: var(--text-muted); font: 400 12px / 18px var(--font-mono); }

/* ── бейджи ── */
.ms-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  height: 24px;
  padding: 0 10px;
  box-sizing: border-box;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  font: 500 12px / 16px var(--font-ui);
  white-space: nowrap;
}
.ms-badge--success { color: var(--success); border-color: color-mix(in srgb, var(--success) 50%, transparent); }
.ms-badge--warning { color: var(--warning); border-color: color-mix(in srgb, var(--warning) 50%, transparent); }
.ms-badge--danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 50%, transparent); }
.ms-badge--accent { background-color: var(--accent); border-color: var(--accent); color: var(--on-accent); }

/* ── нашивки ── */
.ms-patch {
  position: relative;
  display: inline-flex;
  flex: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  box-sizing: border-box;
  border-radius: var(--radius-m);
  background-color: var(--accent);
  color: var(--on-accent);
  vertical-align: middle;
}
.ms-patch--m { width: 100px; height: 64px; }
.ms-patch--s { width: 22px; height: 22px; border-radius: var(--radius-s); }
.ms-patch--l { width: 300px; height: 200px; border-radius: var(--radius-l); gap: 8px; }
.ms-patch__glyph { font: 800 20px / 1 var(--font-ui); }
.ms-patch--s .ms-patch__glyph { font-size: 11px; }
.ms-patch--l .ms-patch__glyph { font-size: 80px; }
.ms-patch__label { font: 600 12px / 16px var(--font-ui); letter-spacing: 0.04em; text-transform: uppercase; }
.ms-patch--l .ms-patch__label { font-size: 28px; line-height: 32px; letter-spacing: 0.06em; }

/* ── Notice ── */
.ms-notice {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-3) var(--space-3) var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: var(--surface-2);
  color: var(--text);
}
.ms-notice__icon { margin-top: 2px; color: var(--text-muted); }
.ms-notice--success .ms-notice__icon { color: var(--success); }
.ms-notice--warning .ms-notice__icon { color: var(--warning); }
.ms-notice--danger .ms-notice__icon { color: var(--danger); }
.ms-notice__body { flex: 1; min-width: 0; }
.ms-notice__title { margin: 0; font: 600 14px / 20px var(--font-ui); }
.ms-notice__text { margin: 2px 0 0; color: var(--text-muted); font: 400 14px / 20px var(--font-ui); }
.ms-notice__action { height: 32px; margin: var(--space-2) 0 0 calc(-1 * var(--space-3)); }

/* ── изменение ── */
.ms-diff { white-space: nowrap; }
.ms-diff__from { color: inherit; opacity: 1; text-decoration-thickness: 1px; }
.ms-diff__to { font-weight: 600; }
.ms-change {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-3) var(--space-3) var(--space-4);
  border-radius: var(--radius-m);
  background-color: var(--accent);
  color: var(--on-accent);
}
.ms-change__body { flex: 1; min-width: 0; }
.ms-change__meta { margin: 0; font: 500 12px / 16px var(--font-ui); }
.ms-change__title { margin: 2px 0 0; font: 600 16px / 24px var(--font-ui); }
.ms-change__title .ms-diff { font-weight: 400; }
.ms-change__actions { display: flex; align-items: center; gap: var(--space-1); }
.ms-change .ms-btn { height: 32px; }

/* ── шкала «бейзлайн → авторское» ── */
.ms-scale { margin: 0; padding: 28px 0 0; min-width: 240px; }
.ms-scale__track { position: relative; height: 16px; margin: 0 6px; }
.ms-scale__axis { position: absolute; left: 0; right: 0; top: 7.5px; height: 1px; background: var(--line-strong); }
.ms-scale__fill { position: absolute; left: 0; top: 7px; height: 2px; background: var(--accent-ink); }
.ms-scale__tick { position: absolute; top: 3px; width: 1px; height: 10px; margin-left: -0.5px; background: var(--line-strong); }
.ms-scale__tick--baseline { top: 0; width: 2px; height: 16px; margin-left: -1px; background: var(--text-muted); }
.ms-scale__tick--author { top: 0; width: 2px; height: 16px; margin-left: -1px; background: var(--gold); }
.ms-scale__you { position: absolute; top: 8px; width: 0; height: 0; }
.ms-scale__dot {
  position: absolute;
  left: -6px;
  top: -6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-ink);
}
.ms-scale__you-label {
  position: absolute;
  bottom: 12px;
  left: 0;
  transform: translateX(-50%);
  color: var(--accent-ink);
  font: 500 12px / 16px var(--font-ui);
  white-space: nowrap;
}
.ms-scale__you-label.is-start { transform: translateX(-8px); }
.ms-scale__you-label.is-end { transform: translateX(calc(-100% + 8px)); }
.ms-scale__labels { position: relative; height: 16px; margin: var(--space-2) 6px 0; color: var(--text-muted); font: 400 12px / 16px var(--font-ui); }
.ms-scale__label { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.ms-scale__label.is-start { transform: translateX(-6px); }
.ms-scale__label.is-end { transform: translateX(calc(-100% + 6px)); }
.ms-scale__label .ms-num { font-size: 12px; }
.ms-scale__label--author { color: var(--gold); }
.ms-scale__labels.has-low { height: 36px; }
.ms-scale__label.is-low { top: 20px; color: var(--text-muted); }
.ms-scale__label.is-low::before { content: ""; position: absolute; left: 50%; top: -20px; height: 16px; border-left: 1px dotted var(--line-strong); }
.ms-scale__label.is-low.is-start::before { left: 6px; }
.ms-scale__label.is-low.is-end::before { left: auto; right: 6px; }
.ms-scale__caption { margin-top: var(--space-3); color: var(--text); font: 500 14px / 20px var(--font-ui); }
.ms-scale--compact { padding-top: 24px; }
.ms-scale--plain .ms-scale__tick--author { background: var(--text); }
.ms-scale--plain .ms-scale__label--author { color: var(--text); }

/* ── лидерборд ── */
.ms-lb { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--surface); }
.ms-lb__head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3) var(--space-4); padding: var(--space-4) var(--space-6); }
.ms-lb__title { margin: 0; font: 600 18px / 24px var(--font-ui); letter-spacing: -0.01em; }
.ms-lb__meta { margin: 2px 0 0; color: var(--text-muted); font: 400 12px / 16px var(--font-mono); }
.ms-lb__tools { margin-left: auto; }
.ms-lb__scroll { overflow: auto; }
.ms-lb table { width: 100%; border-collapse: separate; border-spacing: 0; font: 400 14px / 20px var(--font-ui); }
.ms-lb th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-muted);
  font: 500 12px / 16px var(--font-ui);
  text-align: left;
}
.ms-lb td { padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface); color: var(--text); }
.ms-lb th:first-child, .ms-lb td:first-child { padding-left: var(--space-6); }
.ms-lb th:last-child, .ms-lb td:last-child { padding-right: var(--space-6); }
.ms-lb tbody tr:last-child td { border-bottom: 0; }
.ms-lb__rank { width: 32px; color: var(--text-muted); }
td.ms-lb__rank { font: 400 14px / 20px var(--font-mono); }
.ms-lb__grade { width: 64px; color: var(--text-muted); }
.ms-lb__score { text-align: right; white-space: nowrap; }
th.ms-lb__score { text-align: right; }
.ms-lb__score .ms-num { font-size: 14px; }
.ms-lb__score-in { display: inline-flex; align-items: center; justify-content: flex-end; gap: var(--space-2); }
.ms-lb__row { transition: background-color var(--duration-fast) var(--ease-out); }
.ms-lb__row:hover td, .ms-lb__row.is-hover td { background: var(--surface-2); }
.ms-lb__row.is-clickable { cursor: pointer; }
.ms-lb__row:focus-visible { outline: none; }
.ms-lb__row:focus-visible td, .ms-lb__row.is-focus td { box-shadow: inset 0 2px 0 var(--focus), inset 0 -2px 0 var(--focus); }
.ms-lb__row:focus-visible td:first-child, .ms-lb__row.is-focus td:first-child { box-shadow: inset 0 2px 0 var(--focus), inset 0 -2px 0 var(--focus), inset 2px 0 0 var(--focus); }
.ms-lb__row:focus-visible td:last-child, .ms-lb__row.is-focus td:last-child { box-shadow: inset 0 2px 0 var(--focus), inset 0 -2px 0 var(--focus), inset -2px 0 0 var(--focus); }
.ms-lb__row.is-self td { position: sticky; top: 37px; bottom: 0; z-index: 1; background: var(--accent-subtle); font-weight: 600; }
.ms-lb__row.is-self td:first-child { box-shadow: inset var(--self-stripe, 3px) 0 0 var(--accent-ink); }
.ms-lb__row.is-self .ms-num { font-weight: 600; }
.ms-lb__you { margin-left: var(--space-2); color: var(--accent-ink); font: 500 12px / 16px var(--font-ui); }
.ms-lb__line td { padding-top: 6px; padding-bottom: 6px; font: 500 12px / 16px var(--font-ui); }
.ms-lb__line--author td { color: var(--gold); border-bottom: 1px dashed var(--gold); }
.ms-lb--plain .ms-lb__line--author td { color: var(--text); border-bottom-color: var(--text-muted); }
.ms-lb__line--baseline td { color: var(--text-muted); border-bottom: 1px dashed var(--line-strong); }
.ms-lb__line .ms-num { font-size: 12px; font-weight: 400; }
.ms-lb tbody tr.ms-lb__line:last-child td { border-bottom-width: 1px; }
.ms-lb__gap td { padding-top: 6px; padding-bottom: 6px; color: var(--text-subtle); font: 400 12px / 16px var(--font-ui); }

/* ── сабмиты ── */
.ms-subs { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--surface); }
.ms-subs__head, .ms-sub {
  display: grid;
  grid-template-columns: 40px 48px minmax(0, 1fr) 136px 120px;
  column-gap: var(--space-3);
  align-items: center;
  padding: 0 var(--space-4);
}
.ms-subs__head { height: 36px; border-bottom: 1px solid var(--line); color: var(--text-muted); font: 500 12px / 16px var(--font-ui); }
.ms-subs__head .is-num { text-align: right; }
.ms-sub { position: relative; min-height: 48px; border-bottom: 1px solid var(--line); font: 400 14px / 20px var(--font-ui); transition: background-color var(--duration-fast) var(--ease-out); }
.ms-sub:last-child { border-bottom: 0; }
.ms-sub__n, .ms-sub__time { color: var(--text-muted); font-size: 14px; }
.ms-sub__file { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--text); font-size: 14px; }
.ms-sub__file .ms-icon { color: var(--text-muted); }
.ms-sub__file > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-sub__score { color: var(--text); font-size: 14px; text-align: right; white-space: nowrap; }
.ms-sub__delta { margin-left: var(--space-2); color: var(--text-muted); font-size: 12px; }
.ms-sub__delta.is-up { color: var(--success); }
.ms-sub__status { display: flex; justify-content: flex-start; }
.ms-sub__error { display: flex; grid-column: 3 / -1; gap: 6px; align-items: flex-start; margin: -6px 0 12px; color: var(--text); font: 400 12px / 16px var(--font-ui); }
.ms-sub__error .ms-icon { margin-top: 1px; color: var(--danger); }
.ms-sub.is-clickable { cursor: pointer; }
.ms-sub.is-clickable:hover, .ms-sub.is-hover { background: var(--surface-2); }
.ms-sub:focus-visible, .ms-sub.is-focus { outline: 2px solid var(--focus); outline-offset: -2px; }
@media (max-width: 560px) {
  .ms-subs__head { display: none; }
  .ms-sub { grid-template-columns: 36px minmax(0, 1fr) auto; row-gap: 2px; padding: var(--space-2) var(--space-3); }
  .ms-sub__n { grid-row: 1 / 3; }
  .ms-sub__file { grid-column: 2; grid-row: 1; }
  .ms-sub__time { grid-column: 2; grid-row: 2; font-size: 12px; }
  .ms-sub__score { grid-column: 3; grid-row: 1; }
  .ms-sub__status { grid-column: 3; grid-row: 2; justify-content: flex-end; }
  .ms-sub__error { grid-column: 2 / -1; margin: 4px 0 4px; }
}

/* ── загрузка CSV ── */
.ms-drop { display: flex; flex-direction: column; gap: var(--space-4); }
.ms-drop__zone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 160px;
  padding: var(--space-6);
  box-sizing: border-box;
  border-radius: var(--radius-m);
  background: var(--surface);
  color: var(--text);
  text-align: center;
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--ease-out);
}
.ms-drop__zone:hover, .ms-drop__zone.is-hover, .ms-drop__zone.is-drag { background: var(--surface-2); }
.ms-drop__zone.is-drag .ms-stitch rect { stroke: var(--accent-ink); }
.ms-drop__zone:has(.ms-drop__input:focus-visible), .ms-drop__zone.is-focus { outline: 2px solid var(--focus); outline-offset: 2px; }
.ms-drop__zone.is-disabled { background: var(--surface); color: var(--text-muted); cursor: not-allowed; }
.ms-drop__icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--surface-2); color: var(--text-muted); }
.ms-drop__zone:hover .ms-drop__icon, .ms-drop__zone.is-hover .ms-drop__icon { background: var(--line); color: var(--text); }
.ms-drop__title { font: 500 16px / 24px var(--font-ui); }
.ms-drop__pick { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.ms-drop__hint { color: var(--text-muted); font-size: 12px; line-height: 16px; }
.ms-drop__input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.ms-drop__result { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--surface); }
.ms-drop__file { display: flex; align-items: center; gap: var(--space-2); color: var(--text); }
.ms-drop__file .ms-icon { color: var(--text-muted); }
.ms-drop__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 400 14px / 20px var(--font-mono); }
.ms-drop__size { color: var(--text-muted); font: 400 12px / 16px var(--font-mono); }
.ms-drop__actions { display: flex; flex-wrap: wrap; gap: var(--space-2); padding-top: var(--space-1); }
.ms-check { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; font: 400 14px / 20px var(--font-ui); }
.ms-check li { display: flex; gap: var(--space-2); align-items: flex-start; }
.ms-check .ms-icon { margin-top: 2px; }
.ms-check .is-ok .ms-icon { color: var(--success); }
.ms-check .is-bad .ms-icon { color: var(--danger); }

/* ── карточка задачи ── */
.ms-task {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
  padding: var(--space-4);
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  transition: border-color var(--duration-fast) var(--ease-out);
}
a.ms-task:hover, .ms-task.is-hover { border-color: var(--line-strong); }
a.ms-task:hover .ms-task__title, .ms-task.is-hover .ms-task__title { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.ms-task:focus-visible, .ms-task.is-focus { outline: 2px solid var(--focus); outline-offset: 2px; }
.ms-task__top { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); color: var(--text-muted); font: 500 12px / 16px var(--font-ui); }
.ms-task__kind { display: inline-flex; align-items: center; gap: 6px; color: var(--text); font-weight: 600; }
.ms-task__topic::before { content: "·"; margin-right: var(--space-2); }
.ms-task__status { margin-left: auto; }
.ms-task__title { margin: 0; font: 600 18px / 24px var(--font-ui); letter-spacing: -0.01em; }
.ms-task__progress { display: flex; align-items: center; gap: var(--space-3); color: var(--text-muted); font: 400 12px / 16px var(--font-ui); }
.ms-bar { position: relative; flex: 1; height: 4px; overflow: hidden; border-radius: 2px; background: var(--line); }
.ms-bar > span { display: block; height: 100%; border-radius: 2px; background: var(--accent-ink); }
.ms-task__deadline { display: flex; align-items: center; gap: 6px; color: var(--text-muted); font: 400 12px / 16px var(--font-mono); }
.ms-task__deadline.is-soon { color: var(--warning); font-weight: 600; }
.ms-task.is-disabled { background: transparent; }
.ms-task.is-disabled .ms-task__title, .ms-task.is-disabled .ms-task__kind { color: var(--text-muted); }

/* ── материал ── */
.ms-mat { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--surface); }
.ms-mat__topic { margin: 0; color: var(--text-muted); font: 500 12px / 16px var(--font-ui); }
.ms-mat__title { margin: -4px 0 0; font: 600 18px / 24px var(--font-ui); letter-spacing: -0.01em; }
.ms-mat__meta { margin: -4px 0 0; color: var(--text-muted); font: 400 12px / 16px var(--font-mono); }
.ms-mat__foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); }
.ms-mat__lock { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); font: 400 12px / 16px var(--font-ui); }

/* ── расписание ── */
.ms-tl { container-type: inline-size; padding: var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--surface); }
.ms-tl__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: 0 0 var(--space-3) 20px; }
.ms-tl__title { margin: 0; color: var(--text); font: 600 14px / 20px var(--font-ui); }
.ms-tl__list { margin: 0; padding: 0; list-style: none; }
.ms-tl__item { position: relative; padding: 2px 0 2px 20px; }
.ms-tl__item::before { content: ""; position: absolute; left: 4px; top: 0; bottom: 0; width: 1px; background: var(--line); }
.ms-tl__item:first-child::before { top: 24px; }
.ms-tl__item:last-child::before { bottom: auto; height: 24px; }
.ms-tl__item:only-child::before { display: none; }
.ms-tl__item::after {
  content: "";
  position: absolute;
  left: 0;
  top: 20px;
  width: 9px;
  height: 9px;
  box-sizing: border-box;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
}
.ms-tl__item.is-past::after { background: var(--line-strong); }
.ms-tl__item.is-now::after { border-color: var(--accent-ink); background: var(--accent-ink); }
.ms-tl__event {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr) auto;
  grid-template-areas: "time name place" ". change change";
  column-gap: var(--space-3);
  align-items: start;
  padding: var(--space-3);
  border-radius: var(--radius-m);
  color: inherit;
  text-decoration: none;
  transition: background-color var(--duration-fast) var(--ease-out);
}
a.ms-tl__event:hover, .ms-tl__event.is-hover { background-color: var(--surface-2); }
.ms-tl__event:focus-visible, .ms-tl__event.is-focus { outline: 2px solid var(--focus); outline-offset: 2px; }
.ms-tl__time { grid-area: time; color: var(--text); font-size: 14px; line-height: 24px; white-space: nowrap; }
.ms-tl__name { grid-area: name; min-width: 0; font: 500 16px / 24px var(--font-ui); }
.ms-tl__place { grid-area: place; display: flex; align-items: center; gap: var(--space-2); color: var(--text-muted); font: 400 14px / 24px var(--font-ui); text-align: right; white-space: nowrap; }
.ms-tl__item.is-past .ms-tl__time, .ms-tl__item.is-past .ms-tl__name { color: var(--text-muted); }
.ms-tl__item.is-now .ms-tl__event { background-color: var(--accent); color: var(--on-accent); }
.ms-tl__item.is-now a.ms-tl__event:hover, .ms-tl__item.is-now .ms-tl__event.is-hover { background-color: var(--accent-hover); }
.ms-tl__item.is-now .ms-tl__time, .ms-tl__item.is-now .ms-tl__place { color: var(--on-accent); }
.ms-tl__now { padding: 0 8px; border: 1px solid var(--stitch); border-radius: var(--radius-pill); font: 600 12px / 18px var(--font-ui); }
.ms-tl__change { grid-area: change; display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-top: var(--space-1); color: var(--text-muted); font: 400 14px / 20px var(--font-ui); }
.ms-tl__change .ms-diff__to { color: var(--text); }
.ms-tl__item.is-now .ms-tl__change, .ms-tl__item.is-now .ms-diff__to { color: var(--on-accent); }
.ms-chip-change { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: var(--radius-pill); background-color: var(--accent); color: var(--on-accent); font: 500 12px / 16px var(--font-ui); white-space: nowrap; }
.ms-tl__item.is-now .ms-chip-change { border: 1px solid var(--stitch); background: transparent; }
@container (max-width: 560px) {
  .ms-tl__event { grid-template-columns: 100px minmax(0, 1fr); grid-template-areas: "time name" ". place" ". change"; }
  .ms-tl__place { justify-content: flex-start; text-align: left; }
}
@container (max-width: 360px) {
  .ms-tl__event { grid-template-columns: minmax(0, 1fr); grid-template-areas: "time" "name" "place" "change"; }
}

/* ── пустое состояние и ошибка ── */
.ms-state { display: flex; flex-direction: column; align-items: center; gap: var(--space-3); max-width: 440px; margin: 0 auto; padding: var(--space-12) var(--space-6); text-align: center; }
.ms-state__art { margin-bottom: var(--space-1); color: var(--line-strong); }
.ms-state__dot { stroke: var(--accent-ink); }
.ms-state__axis { fill: var(--text-muted); font: 400 12px var(--font-mono); }
.ms-state__icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--surface-2); color: var(--danger); }
.ms-state__title { margin: 0; font: 400 22px / 28px var(--font-head); letter-spacing: 0.01em; text-transform: uppercase; }
.ms-state__text { margin: 0; color: var(--text-muted); font: 400 14px / 20px var(--font-ui); }
.ms-state__code { margin: 0; color: var(--text-muted); font-size: 12px; line-height: 16px; }
.ms-state__action { padding-top: var(--space-2); }

/* ── скелетон ── */
.ms-skel { display: block; height: 12px; border-radius: var(--radius-s); background: var(--surface-2); animation: ms-pulse 1.4s var(--ease-out) infinite alternate; }
.ms-skel--block { border-radius: var(--radius-m); }
.ms-skel--pill { border-radius: var(--radius-pill); }
.ms-skel--circle { border-radius: 50%; }
.ms-skel-text { display: flex; flex-direction: column; gap: var(--space-2); }
@keyframes ms-pulse { from { opacity: 1; } to { opacity: 0.5; } }

/* ── ⌘K ── */
.ms-cmd-scrim { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 15vh var(--space-4) var(--space-4); background: var(--scrim); animation: ms-fade var(--duration-base) var(--ease-out); }
.ms-cmd { display: flex; flex-direction: column; width: min(560px, 100%); overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--surface); box-shadow: var(--shadow-pop); animation: ms-rise var(--duration-base) var(--ease-out); }
.ms-cmd--inline { animation: none; }
.ms-cmd__search { display: flex; align-items: center; gap: var(--space-3); height: 52px; padding: 0 var(--space-3) 0 var(--space-4); border-bottom: 1px solid var(--line); color: var(--text-muted); }
.ms-cmd__search:focus-within { box-shadow: inset 0 -2px 0 var(--focus); }
.ms-cmd__input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; color: var(--text); font: 400 16px / 24px var(--font-ui); }
.ms-cmd__input::placeholder { color: var(--text-subtle); opacity: 1; }
.ms-cmd__list { max-height: 320px; overflow: auto; padding: var(--space-2); }
.ms-cmd__group { margin: 0; padding: var(--space-2) var(--space-2) var(--space-1); color: var(--text-muted); font: 500 12px / 16px var(--font-ui); }
.ms-cmd__item { display: flex; align-items: center; gap: var(--space-3); height: 40px; padding: 0 var(--space-2); border-radius: var(--radius-s); color: var(--text); font: 400 14px / 20px var(--font-ui); cursor: pointer; }
.ms-cmd__item .ms-icon { color: var(--text-muted); }
.ms-cmd__item.is-active { background: var(--surface-2); }
.ms-cmd__item.is-active .ms-icon { color: var(--text); }
.ms-cmd__item.is-disabled { color: var(--text-subtle); cursor: not-allowed; }
.ms-cmd__label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-cmd__hint { color: var(--text-muted); font: 400 12px / 16px var(--font-mono); }
.ms-cmd__kbd { display: inline-flex; }
.ms-cmd__empty { margin: 0; padding: var(--space-6); color: var(--text-muted); font: 400 14px / 20px var(--font-ui); text-align: center; }
.ms-cmd__foot { display: flex; gap: var(--space-4); padding: var(--space-2) var(--space-4); border-top: 1px solid var(--line); color: var(--text-muted); font: 400 12px / 20px var(--font-ui); }
.ms-cmd__foot .ms-kbd { margin-right: 4px; }
@keyframes ms-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes ms-rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ── карточка достижения 1080 × 1350 ── */
.ms-ach-frame { position: relative; flex: none; overflow: hidden; }
.ms-ach { position: absolute; left: 0; top: 0; width: 1080px; height: 1350px; overflow: hidden; transform-origin: 0 0; background: var(--bg); color: var(--text); font-family: var(--font-ui); }
.ms-ach__dots { position: absolute; inset: 0; fill: var(--line); }
.ms-ach__top { position: absolute; left: 120px; right: 120px; top: 120px; display: flex; align-items: center; gap: 32px; }
.ms-ach__org { color: var(--text-muted); font: 600 28px / 36px var(--font-ui); letter-spacing: 0.08em; text-transform: uppercase; }
.ms-ach__mid { position: absolute; left: 120px; right: 120px; top: 430px; }
.ms-ach__metric { margin: 0; color: var(--text-muted); font-size: 36px; line-height: 44px; }
.ms-ach__score { --o: 2px; --d: 8px; margin: 24px 0 0 -6px; font-size: 200px; line-height: 0.95; letter-spacing: 0; }
.ms-ach__task { margin: 48px 0 0; font: 800 64px / 72px var(--font-ui); letter-spacing: -0.02em; }
.ms-ach__bottom { position: absolute; left: 120px; right: 120px; bottom: 120px; display: flex; align-items: flex-end; justify-content: space-between; }
.ms-ach__date { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; color: var(--text-muted); font-size: 36px; line-height: 44px; }
.ms-ach__date .ms-num { font-size: 36px; }
.ms-ach__place { color: var(--text); font: 600 36px / 44px var(--font-ui); }

/* ── мобильный ── */
@media (max-width: 640px) {
  .ms-btn { --h: var(--control-h-touch, 44px); }
  .ms-field__control { height: var(--control-h-touch, 44px); }
  .ms-header { gap: var(--space-3); padding: 0 var(--page-gutter-mobile, 16px); }
  .ms-header__nav { overflow-x: auto; }
  .ms-cmdk__label { display: none; }
  .ms-lb th:first-child, .ms-lb td:first-child { padding-left: var(--space-4); }
  .ms-lb th:last-child, .ms-lb td:last-child { padding-right: var(--space-4); }
  .ms-lb__head { padding: var(--space-4); }
}

@media (prefers-reduced-motion: reduce) {
  .ms-btn, .ms-iconbtn, .ms-navlink, .ms-cmdk, .ms-field__control, .ms-seg__item, .ms-tab, .ms-lb__row, .ms-sub, .ms-drop__zone, .ms-task, .ms-tl__event { transition: none; }
  .ms-skel, .ms-cmd-scrim, .ms-cmd { animation: none; }
}
