/* =========================================================================
   momo · Сервисы Минобра МО — общий стиль 2026 (ред. 2 — широкие страницы и таблицы)
   Один файл на все страницы сервера: вход, портал, сервисы, панель
   учётных записей, ошибки. Подключать после fonts.css:

     <link rel="stylesheet" href="/ui/fonts.css">
     <link rel="stylesheet" href="/ui/momo-2026.css">

   Заменяет www/ui/momo.css, tokens.css и momo-head.css. Старые классы
   (.card, .tile, .who, nav a.on …) не переиспользуются: у новых
   префикс m- чтобы обе версии могли жить рядом на время перехода.
   ========================================================================= */

:root {
  color-scheme: light;

  /* Поверхности */
  --m-page: #f4f4f5;        /* фон страницы */
  --m-paper: #ffffff;       /* карточки */
  --m-line: #e3e3ea;        /* рамки карточек и полей таблиц */
  --m-line-soft: #efeff3;   /* разделители строк */
  --m-thead: #fafafb;       /* шапка таблицы */
  --m-hover: #f6f5fc;       /* наведение на строку */
  --m-field: #cdccd8;       /* рамка поля ввода */

  /* Текст */
  --m-ink: #1c1b29;         /* основной */
  --m-label: #3d3c4d;       /* подписи полей */
  --m-soft: #5b5a6b;        /* пояснения */
  --m-quiet: #8b8a99;       /* третьестепенное */

  /* Акцент сервера: кнопки, ссылки, активные вкладки, фокус */
  --m-accent: #5a46c8;
  --m-accent-hover: #4835a8;
  --m-accent-ink: #4c39b5;  /* текст ссылок */
  --m-accent-soft: #efedfb; /* мягкий фон, счётчики */
  --m-focus: 0 0 0 3px rgba(90, 70, 200, .16);

  /* Шапка */
  --m-head: #3d3a55;        /* мягкий графит */
  --m-head-ink: #ffffff;
  --m-head-soft: rgba(255, 255, 255, .72);

  /* Состояния — точка + слово, цветом только точка */
  --m-ok: #0a7b47;   --m-ok-soft: #eefaf3;
  --m-warn: #c77700; --m-warn-ink: #8a5a00; --m-warn-soft: #fff8e8;
  --m-err: #b42318;  --m-err-soft: #fef3f2;

  /* Цвет текущего сервиса — ставится на <body data-svc="..."> (см. ниже) */
  --m-svc: #4b4868;
  --m-svc-soft: #ebeaf2;

  /* Шрифты */
  --m-font: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --m-font-head: 'Montserrat', 'Manrope', system-ui, sans-serif;
  --m-mono: ui-monospace, SFMono-Regular, Consolas, monospace;

  /* Размеры */
  --m-wrap: 1200px;
  --m-radius: 14px;
  --m-radius-s: 9px;
  --m-ease: cubic-bezier(.2, .7, .2, 1);
}

/* Цвета сервисов (значок + линия под шапкой). Кнопки ими НЕ красить. */
[data-svc="izm"]        { --m-svc: #a35c12; --m-svc-soft: #fbefdf; }
[data-svc="sady"]       { --m-svc: #2f7a4a; --m-svc-soft: #e3f3e8; }
[data-svc="zayavleniya"]{ --m-svc: #2f62c4; --m-svc-soft: #e4ecfb; }
[data-svc="formcraft"]  { --m-svc: #5a46c8; --m-svc-soft: #ece9fb; }
[data-svc="reestr"]     { --m-svc: #12807e; --m-svc-soft: #def3f2; }
[data-svc="vshu"]       { --m-svc: #b2366b; --m-svc-soft: #fbe5ee; }
[data-svc="kontingent"] { --m-svc: #2b7bb9; --m-svc-soft: #e0f0fb; }
[data-svc="momoadmin"]  { --m-svc: #4b4868; --m-svc-soft: #ebeaf2; }
[data-svc="nadzor"]     { --m-svc: #6b5f2e; --m-svc-soft: #f3efdc; }

/* ---------- база ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 15px/1.55 var(--m-font);
  color: var(--m-ink);
  background: var(--m-page);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--m-accent-ink); }
a:hover { color: var(--m-accent-hover); }
h1, h2, h3, .m-ttl { font-family: var(--m-font-head); letter-spacing: -.01em; margin: 0; }
h1 { font-size: 26px; line-height: 1.15; }
h2 { font-size: 18px; line-height: 1.25; }
h3 { font-size: 15px; line-height: 1.3; }
code { font: 13px var(--m-mono); background: #f1f1f4; padding: 1px 5px; border-radius: 5px; }
.m-num { text-align: right; font-variant-numeric: tabular-nums; }
.m-soft { color: var(--m-soft); }
.m-quiet { color: var(--m-quiet); }
.m-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- раскладка ---------- */
.m-wrap { max-width: var(--m-wrap); margin: 0 auto; padding: 0 24px; }
.m-page-head { padding: 26px 0 0; display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: flex-end; justify-content: space-between; }
.m-page-head .m-lead { margin-top: 4px; color: var(--m-soft); font-size: 15px; max-width: 72ch; }
.m-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.m-stack { display: flex; flex-direction: column; gap: 16px; }
@media (max-width: 640px) { .m-wrap { padding: 0 16px; } h1 { font-size: 22px; } }

/* ---------- шапка сервиса (разметка — ui/momo-head.html) ---------- */
.m-head { position: relative; background: var(--m-head); color: var(--m-head-ink); }
.m-head__in { max-width: var(--m-wrap); margin: 0 auto; padding: 12px 24px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.m-head__mark { width: 32px; height: 32px; flex: none; display: block; }
.m-head__crumb { color: var(--m-head-soft); font-weight: 600; font-size: 14px; text-decoration: none; }
.m-head__crumb:hover { color: #fff; }
.m-head__sep { width: 14px; height: 14px; color: rgba(255, 255, 255, .45); flex: none; }
.m-head__svc { width: 32px; height: 32px; border-radius: 9px; background: var(--m-svc-soft); color: var(--m-svc); display: grid; place-items: center; flex: none; }
.m-head__svc svg { width: 19px; height: 19px; }
.m-head__title { font-family: var(--m-font-head); font-weight: 700; font-size: 17px; }
.m-head__sp { flex: 1; }
.m-head__who { font-size: 13px; color: var(--m-head-soft); }
.m-head__who b { color: #fff; font-weight: 600; }
.m-head__all { height: 36px; padding: 0 12px; border-radius: 9px; border: 1px solid rgba(255, 255, 255, .22); background: rgba(255, 255, 255, .06); color: #fff; font: 600 13px var(--m-font); display: inline-flex; align-items: center; gap: 8px; text-decoration: none; cursor: pointer; transition: background .15s, border-color .15s; }
.m-head__all:hover { background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .35); color: #fff; }
.m-head__line { position: absolute; left: 0; right: 0; bottom: -3px; height: 3px; background: var(--m-svc); transform-origin: left center; animation: m-line .6s var(--m-ease) both; }
/* меню «Все сервисы» */
.m-menu { position: absolute; right: 0; top: 44px; width: 420px; max-width: calc(100vw - 32px); background: #fff; color: var(--m-ink); border-radius: var(--m-radius); box-shadow: 0 18px 44px rgba(28, 27, 41, .22); padding: 10px; z-index: 50; transform-origin: top right; animation: m-drop .22s var(--m-ease) both; }
.m-menu[hidden] { display: none; }
.m-menu__cap { padding: 6px 10px 8px; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--m-quiet); }
.m-menu__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px; }
.m-menu__it { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 10px; color: var(--m-ink); text-decoration: none; font-size: 14px; font-weight: 500; transition: background .12s; }
.m-menu__it:hover { background: #f4f4f7; color: var(--m-ink); }
.m-menu__it[aria-current="page"] { background: #f1effc; }
.m-menu__ic { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none; }
.m-menu__ic svg { width: 18px; height: 18px; }
.m-menu__foot { display: block; margin-top: 6px; padding: 10px; border-top: 1px solid var(--m-line-soft); font-size: 14px; font-weight: 600; text-decoration: none; }
@media (max-width: 640px) { .m-head__in { padding: 10px 16px; } .m-head__who { display: none; } .m-menu__grid { grid-template-columns: 1fr; } }

/* ---------- карточки и KPI ---------- */
.m-card { background: var(--m-paper); border: 1px solid var(--m-line); border-radius: var(--m-radius); padding: 20px 22px; }
.m-card__head { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: baseline; margin-bottom: 14px; }
.m-card__head h2 { font-size: 17px; }
.m-card__head .m-soft { font-size: 13px; }
.m-kpis { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.m-kpi { background: var(--m-paper); border: 1px solid var(--m-line); border-radius: var(--m-radius); padding: 16px 18px; }
.m-kpi__v { font-family: var(--m-font-head); font-size: 28px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.m-kpi__l { margin-top: 4px; font-size: 13px; color: var(--m-soft); }
button.m-kpi { text-align: left; font: inherit; color: inherit; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
button.m-kpi:hover { border-color: #c9c0f2; transform: translateY(-1px); }
button.m-kpi[aria-pressed="true"] { border-color: var(--m-accent); box-shadow: var(--m-focus); }

/* ---------- плитки портала ---------- */
.m-tile { display: flex; gap: 14px; align-items: flex-start; padding: 18px; background: var(--m-paper); border: 1px solid var(--m-line); border-radius: 12px; text-decoration: none; color: var(--m-ink); transition: border-color .15s, box-shadow .2s, transform .2s; }
.m-tile:hover { border-color: #c9c0f2; box-shadow: 0 10px 26px rgba(28, 27, 41, .10); transform: translateY(-2px); color: var(--m-ink); }
.m-tile:focus-visible { outline: none; border-color: var(--m-accent); box-shadow: var(--m-focus); }
.m-tile__ic { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; flex: none; transition: transform .3s cubic-bezier(.3, 1.4, .5, 1); }
.m-tile__ic svg { width: 23px; height: 23px; }
.m-tile:hover .m-tile__ic { transform: translateY(-2px) rotate(-6deg) scale(1.06); }
.m-tile__t { font-weight: 650; font-size: 16px; line-height: 1.3; }
.m-tile__d { font-size: 14px; color: var(--m-soft); line-height: 1.45; margin-top: 4px; }

/* ---------- кнопки ---------- */
.m-btn, .m-ghost { height: 40px; padding: 0 16px; border-radius: var(--m-radius-s); font: 600 14px var(--m-font); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; text-decoration: none; transition: background .15s, border-color .15s, transform .12s, box-shadow .2s; }
.m-btn { border: 0; background: var(--m-accent); color: #fff; }
.m-btn:hover { background: var(--m-accent-hover); color: #fff; box-shadow: 0 6px 16px rgba(90, 70, 200, .28); transform: translateY(-1px); }
.m-ghost { border: 1px solid var(--m-field); background: #fff; color: var(--m-ink); padding: 0 14px; }
.m-ghost:hover { border-color: #b3a9e6; background: #f7f7fa; color: var(--m-ink); }
.m-btn:active, .m-ghost:active { transform: scale(.98); }
.m-btn:disabled { background: #b3a9e6; box-shadow: none; transform: none; cursor: default; }
.m-ghost:disabled { color: var(--m-quiet); border-color: var(--m-line); background: #fff; cursor: default; }
.m-ghost--danger { color: var(--m-err); }
.m-ghost--danger:hover { border-color: #f3a59b; background: var(--m-err-soft); color: var(--m-err); }
.m-btn--lg { height: 48px; padding: 0 22px; font-size: 16px; border-radius: 10px; }
.m-btn--block { width: 100%; }
.m-link { background: none; border: 0; padding: 0; font: inherit; color: var(--m-accent-ink); cursor: pointer; text-align: left; }
.m-link:hover { color: var(--m-accent-hover); text-decoration: underline; text-underline-offset: 3px; }
.m-spin { width: 18px; height: 18px; border: 2.5px solid rgba(255, 255, 255, .4); border-top-color: #fff; border-radius: 50%; animation: m-spin .7s linear infinite; }

/* ---------- вкладки ---------- */
.m-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 18px 0; }
.m-tab { height: 36px; padding: 0 13px; border: 0; border-radius: var(--m-radius-s); background: none; color: var(--m-soft); font: 600 14px var(--m-font); cursor: pointer; display: inline-flex; align-items: center; gap: 7px; text-decoration: none; transition: background .15s, color .15s, box-shadow .15s; }
.m-tab:hover { color: var(--m-ink); background: #ebebf0; }
.m-tab[aria-selected="true"], .m-tab.is-on { background: #fff; color: var(--m-ink); box-shadow: 0 1px 3px rgba(28, 27, 41, .10); }
.m-count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--m-accent-soft); color: var(--m-accent-ink); font-size: 12px; font-weight: 700; display: inline-grid; place-items: center; }
.m-tabpanel { animation: m-rise .4s var(--m-ease) both; }

/* сегмент «Нет / Работа / Управление», «Принято / На доработку / Не принято» */
.m-seg { display: inline-flex; background: #f2f2f6; border-radius: var(--m-radius-s); padding: 3px; gap: 2px; }
.m-seg button { height: 30px; padding: 0 12px; border: 0; border-radius: 7px; background: none; font: 600 13px var(--m-font); color: var(--m-soft); cursor: pointer; white-space: nowrap; transition: background .15s, color .15s, box-shadow .15s; }
.m-seg button:hover { color: var(--m-ink); }
.m-seg button[aria-pressed="true"] { background: #fff; color: var(--m-ink); box-shadow: 0 1px 3px rgba(28, 27, 41, .12); }
.m-seg button:disabled { color: #b8b7c4; cursor: not-allowed; }

/* ---------- поля ---------- */
.m-field { display: flex; flex-direction: column; gap: 6px; }
.m-label { font-size: 13px; font-weight: 600; color: var(--m-label); }
.m-hint { font-size: 13px; color: var(--m-soft); }
.m-input, .m-select, .m-textarea { width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--m-field); border-radius: var(--m-radius-s); font: 15px var(--m-font); color: var(--m-ink); background: #fff; transition: border-color .15s, box-shadow .15s; }
.m-textarea { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.m-input:focus, .m-select:focus, .m-textarea:focus { outline: none; border-color: var(--m-accent); box-shadow: var(--m-focus); }
.m-input[aria-invalid="true"], .m-textarea[aria-invalid="true"] { border-color: var(--m-err); }
.m-input--lg { height: 46px; padding: 0 14px; font-size: 16px; border-radius: 10px; }
.m-check { width: 18px; height: 18px; accent-color: var(--m-accent); margin: 0; flex: none; }
.m-search { position: relative; }
.m-search svg { position: absolute; left: 12px; top: 11px; width: 18px; height: 18px; color: var(--m-quiet); pointer-events: none; }
.m-search .m-input { padding-left: 38px; }
.m-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.m-filters > * { flex: 0 1 190px; }
.m-filters > .m-search { flex: 1 1 260px; }

/* ---------- состояние: точка + слово ---------- */
.m-state { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; color: var(--m-ink); }
.m-state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--dot, var(--m-quiet)); flex: none; }
.m-state--ok   { --dot: var(--m-ok); }
.m-state--new  { --dot: var(--m-accent); }
.m-state--warn { --dot: var(--m-warn); }
.m-state--err  { --dot: var(--m-err); }
.m-state--off  { --dot: var(--m-quiet); }
.m-state--wait::before { background: #fff; box-shadow: inset 0 0 0 2px var(--dot-ring, var(--m-accent)); }

/* ---------- сообщения ---------- */
.m-note { padding: 11px 14px; border-radius: 10px; font-size: 14px; border: 1px solid; }
.m-note--err  { background: var(--m-err-soft); border-color: #fbd3ce; color: var(--m-err); }
.m-note--warn { background: var(--m-warn-soft); border-color: #f0dcae; color: var(--m-warn-ink); }
.m-note--ok   { background: var(--m-ok-soft); border-color: #bfe6d2; color: var(--m-ok); }
.m-note--info { background: #f1f1f4; border-color: transparent; color: var(--m-soft); }
.m-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); max-width: calc(100% - 32px); background: var(--m-ink); color: #fff; padding: 12px 16px; border-radius: 10px; font-size: 14px; display: flex; gap: 10px; align-items: center; box-shadow: 0 12px 30px rgba(28, 27, 41, .25); z-index: 100; overflow: hidden; animation: m-toast .3s var(--m-ease) both; }
.m-toast::after { content: ""; position: absolute; left: 0; bottom: 0; height: 3px; background: #a99cf0; animation: m-shrink 2.8s linear forwards; }
.m-savebar { position: sticky; bottom: 16px; margin-top: 16px; background: var(--m-ink); color: #fff; border-radius: 12px; padding: 12px 14px 12px 18px; display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; box-shadow: 0 12px 30px rgba(28, 27, 41, .25); animation: m-barup .3s var(--m-ease) both; }

/* ---------- таблицы ---------- */
.m-tablebox { background: var(--m-paper); border: 1px solid var(--m-line); border-radius: 12px; overflow-x: auto; }
.m-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.m-table th { text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--m-soft); padding: 11px 14px; border-bottom: 1px solid var(--m-line); background: var(--m-thead); white-space: nowrap; }
.m-table th[aria-sort] { cursor: pointer; }
.m-table th[aria-sort="ascending"]::after { content: " ↑"; }
.m-table th[aria-sort="descending"]::after { content: " ↓"; }
.m-table td { padding: 11px 14px; border-bottom: 1px solid var(--m-line-soft); vertical-align: top; }
.m-table tr:last-child td { border-bottom: 0; }
.m-table tbody tr { animation: m-row .3s ease both; }
.m-table tbody tr.is-link { cursor: pointer; transition: background .12s; }
.m-table tbody tr.is-link:hover { background: var(--m-hover); }

/* полоса в таблице / на графике */
.m-bar { height: 8px; border-radius: 4px; background: #ebebf0; overflow: hidden; display: flex; }
.m-bar > span { height: 100%; transform-origin: left center; animation: m-grow .7s cubic-bezier(.2, .8, .2, 1) both; }

/* ---------- окно ---------- */
.m-dialog { border: 0; border-radius: 16px; padding: 0; width: min(720px, calc(100vw - 32px)); box-shadow: 0 24px 60px rgba(28, 27, 41, .3); color: var(--m-ink); }
.m-dialog::backdrop { background: rgba(28, 27, 41, .45); }
.m-dialog[open] { animation: m-rise .3s var(--m-ease) both; }

/* ---------- анимация ---------- */
.m-rise { animation: m-rise .45s var(--m-ease) both; }
.m-fade { animation: m-fade .3s ease both; }
.m-draw { stroke-dasharray: 24; stroke-dashoffset: 24; animation: m-draw .55s cubic-bezier(.6, 0, .2, 1) .2s forwards; }
.m-shake { animation: m-shake .4s ease; }
@keyframes m-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes m-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes m-row { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes m-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes m-line { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes m-drop { from { opacity: 0; transform: translateY(-6px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes m-toast { from { opacity: 0; transform: translate(-50%, 16px) scale(.97); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes m-barup { from { opacity: 0; transform: translateY(100%); } to { opacity: 1; transform: none; } }
@keyframes m-shrink { from { width: 100%; } to { width: 0; } }
@keyframes m-draw { to { stroke-dashoffset: 0; } }
@keyframes m-spin { to { transform: rotate(360deg); } }
@keyframes m-shake { 0%, 100% { transform: none; } 20% { transform: translateX(-7px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(2px); } }

/* Знак-книга раскрывается (вход, первый вход, промо): классы на <svg class="m-book m-book--anim"> */
.m-book path { transform-box: fill-box; }
.m-book--anim .m-book__cover { animation: m-bk-cover .5s var(--m-ease) .15s both; }
.m-book--anim .m-book__l { transform-origin: right center; animation: m-bk-open .6s cubic-bezier(.2, .8, .2, 1) .45s both; }
.m-book--anim .m-book__r { transform-origin: left center; animation: m-bk-open .6s cubic-bezier(.2, .8, .2, 1) .55s both; }
.m-book--anim .m-book__ln { stroke-dasharray: 14; stroke-dashoffset: 14; animation: m-draw .45s ease 1s forwards; }
.m-book--anim .m-book__ln2 { stroke-dasharray: 14; stroke-dashoffset: 14; animation: m-draw .45s ease 1.15s forwards; }
.m-book--anim .m-book__rb { transform-origin: top center; animation: m-bk-drop .55s cubic-bezier(.3, 1.45, .5, 1) 1.4s both; }
@keyframes m-bk-cover { from { opacity: 0; transform: translateY(4px) scale(.9); } }
@keyframes m-bk-open { from { transform: scaleX(0); } }
@keyframes m-bk-drop { from { transform: scaleY(0); } }


/* =========================================================================
   Поправка 06.10.2026: широкие страницы и большие таблицы
   Причина: страницы с данными зажаты в 1200 px, таблицы в коротких окошках
   прокручиваются в обе стороны, шапка таблицы и первая колонка уезжают.
   ========================================================================= */

/* 1. Ширина. Страницы с таблицами и графиками (ВШУ, Заявления, Контингент,
      Сады — Сводка/Организации, Проверка по ИНН — Дашборд) — широкие.
      <body data-layout="wide"> или <div class="m-wrap m-wrap--wide">.
      Формы и карточки человека остаются в 1200 px — длинная строка ввода читается хуже. */
.m-wrap--wide, [data-layout="wide"] .m-wrap, [data-layout="wide"] .m-head__in { max-width: 1680px; }
@media (min-width: 1900px) { .m-wrap--wide, [data-layout="wide"] .m-wrap, [data-layout="wide"] .m-head__in { max-width: 1840px; } }

/* 2. Раскладка блоков. Два блока рядом — только если каждому хватает места;
      иначе они сами встают друг под другом (а не сжимаются до прокрутки). */
.m-cols { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 560px), 1fr)); align-items: start; }
.m-cols--charts { grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); }
/* Таблица с 5+ колонками — всегда во всю ширину строки, даже внутри .m-cols */
.m-cols > .m-span-all { grid-column: 1 / -1; }

/* 3. Таблица-окно: одна прокрутка вместо двух.
      Высота окна = высота экрана минус шапка, поэтому на странице видна целиком,
      а внутри прокручиваются строки; шапка таблицы и первая колонка стоят на месте.
      Использовать для таблиц длиннее ~15 строк. Короткие — обычный .m-tablebox без высоты. */
.m-tablebox--fit { max-height: calc(100vh - 120px); min-height: 240px; overflow: auto; overscroll-behavior: contain; }
.m-tablebox--fit .m-table thead th { position: sticky; top: 0; z-index: 3; box-shadow: inset 0 -1px 0 var(--m-line); }
.m-table--fix1 tbody td:first-child, .m-table--fix1 thead th:first-child { position: sticky; left: 0; z-index: 2; background: var(--m-paper); box-shadow: inset -1px 0 0 var(--m-line-soft); }
.m-table--fix1 thead th:first-child { z-index: 4; background: var(--m-thead); }
.m-table--fix1 tbody tr.is-link:hover td:first-child { background: var(--m-hover); }
/* тень у края, когда таблицу можно прокрутить вбок — видно, что колонки есть дальше */
.m-tablebox--fit, .m-tablebox {
  background:
    linear-gradient(90deg, var(--m-paper) 30%, rgba(255,255,255,0)) left center / 28px 100% no-repeat local,
    linear-gradient(270deg, var(--m-paper) 30%, rgba(255,255,255,0)) right center / 28px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, rgba(28,27,41,.12), rgba(28,27,41,0)) left center / 12px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, rgba(28,27,41,.12), rgba(28,27,41,0)) right center / 12px 100% no-repeat scroll,
    var(--m-paper);
}

/* 4. Колонки. Шапка переносится словами (не по буквам), числа не переносятся,
      длинные названия — максимум 2 строки, полный текст в title. */
.m-table th { white-space: normal; vertical-align: bottom; line-height: 1.25; min-width: 72px; }
.m-table th.m-num { text-align: right; }
.m-table td.m-num, .m-table th.m-num { white-space: nowrap; }
.m-table .m-col-okrug { min-width: 180px; }
.m-table .m-col-name { min-width: 240px; max-width: 420px; }
.m-table .m-col-text { min-width: 320px; max-width: 560px; }
@media (max-width: 640px) { .m-table .m-col-okrug { min-width: 130px; } .m-table .m-col-name { min-width: 180px; } .m-table .m-col-text { min-width: 220px; } }
.m-clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.m-table .m-col-zone { width: 92px; min-width: 92px; }
/* «Городской округ» в каждой строке — шум: служба убирает хвост, полное название — в title */

/* плотность: для таблиц от 8 колонок */
.m-table--dense { font-size: 13.5px; }
.m-table--dense th { padding: 9px 10px; }
.m-table--dense td { padding: 8px 10px; }

/* 5. Порции вместо обрезки «первые 800 строк». 100 строк на страницу,
      счётчик и переход; поиск/фильтры — над таблицей. */
.m-pager { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: space-between; padding: 10px 2px 0; font-size: 13px; color: var(--m-soft); }
.m-pager__nav { display: flex; gap: 4px; align-items: center; }
.m-pager__nav button { min-width: 34px; height: 32px; padding: 0 8px; border: 1px solid var(--m-line); border-radius: 8px; background: #fff; font: 600 13px var(--m-font); color: var(--m-ink); cursor: pointer; font-variant-numeric: tabular-nums; }
.m-pager__nav button:hover { border-color: #b3a9e6; }
.m-pager__nav button[aria-current="page"] { background: var(--m-accent); border-color: var(--m-accent); color: #fff; }
.m-pager__nav button:disabled { color: var(--m-quiet); cursor: default; }

/* 6. Графики. Подсказка не вылезает за карточку: карточка графика — точка отсчёта,
      скрипт ставит подсказку слева от точки, если справа не хватает места (класс --left). */
.m-chart { position: relative; overflow: visible; }
.m-chart svg { width: 100%; height: auto; display: block; }
.m-chart__tip { position: absolute; z-index: 5; pointer-events: none; max-width: 260px; background: var(--m-ink); color: #fff; border-radius: 9px; padding: 8px 11px; font-size: 12.5px; line-height: 1.45; box-shadow: 0 10px 24px rgba(28,27,41,.22); white-space: nowrap; transform: translate(12px, -50%); }
.m-chart__tip--left { transform: translate(calc(-100% - 12px), -50%); }

/* Кто отключил движение в системе — анимаций нет вовсе */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
}
