/* Тема: по умолчанию тёмная (независимо от настроек системы); светлая — переключателем в шапке, выбор хранится в
   браузере (theme.js ставит <html data-theme="light|dark"> до отрисовки страницы). Печать — всегда светлая. */
:root, :root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #14171c; --panel: #1d2128; --text: #e7eaf0; --muted: #98a2b3; --line: #2c323c;
  --accent: #4fa8c7; --accent-text: #0d1a20; --accent-soft: #1e2f37; --error: #f97066;
  --ok-bg: #16301f; --ok-fg: #7fdc9b; --ok-line: #2c6b40; --bad-bg: #3a1d1a; --bad-fg: #ff9a90; --bad-line: #7a3630;
  --warn-bg: #3a3210; --warn-fg: #f0d478; --warn-line: #6b5a1e;
  --orange-bg: #3d2712; --orange-fg: #f5a967; --orange-line: #7a4a20;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f6f8; --panel: #fff; --text: #1d2330; --muted: #667085; --line: #e3e6eb;
  --accent: #1a6b8a; --accent-text: #fff; --accent-soft: #e6f2f6; --error: #b42318;
  --ok-bg: #e3f5e8; --ok-fg: #14612b; --ok-line: #8fd3a2; --bad-bg: #fde8e6; --bad-fg: #a3271b; --bad-line: #f1a59d;
  --warn-bg: #fdf3d6; --warn-fg: #7a5c00; --warn-line: #e8c964;
  --orange-bg: #fce3cf; --orange-fg: #8a3d0a; --orange-line: #eda36b;
}
@media print {
  :root, :root[data-theme] {
    color-scheme: light;
    --bg: #f5f6f8; --panel: #fff; --text: #1d2330; --muted: #667085; --line: #e3e6eb;
    --accent: #1a6b8a; --accent-text: #fff; --accent-soft: #e6f2f6; --error: #b42318;
    --ok-bg: #e3f5e8; --ok-fg: #14612b; --ok-line: #8fd3a2; --bad-bg: #fde8e6; --bad-fg: #a3271b; --bad-line: #f1a59d;
    --warn-bg: #fdf3d6; --warn-fg: #7a5c00; --warn-line: #e8c964;
    --orange-bg: #fce3cf; --orange-fg: #8a3d0a; --orange-line: #eda36b;
  }
}

/* ---------- переключатель темы (шапка) */
/* отдельной строкой под шапкой, у правого края (в шапке он сдвигал её вниз у МИАЦ/Администратора — там больше кнопок);
   подписи нет — режим понятен по значку в ползунке: солнце — светлая тема, луна — тёмная */
.theme-bar { display: flex; justify-content: flex-end; padding: 8px 24px 0; }
.theme-bar + main { padding-top: 8px; }
.theme-switch { position: relative; display: inline-flex; cursor: pointer; user-select: none; }
.theme-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.theme-switch .track { position: relative; width: 50px; height: 26px; border-radius: 13px; background: var(--line);
                       border: 1px solid var(--line); transition: background .2s; }
.theme-switch .knob { position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
                      background: var(--panel); box-shadow: 0 1px 3px rgba(0,0,0,.35); transition: transform .2s; }
.theme-switch svg { width: 14px; height: 14px; }
.theme-switch .i-sun { color: #e8a317; }
.theme-switch .i-moon { color: var(--accent); display: none; }
.theme-switch input:checked + .track { background: var(--accent-soft); }
.theme-switch input:checked + .track .knob { transform: translateX(24px); }
.theme-switch input:checked + .track .i-sun { display: none; }
.theme-switch input:checked + .track .i-moon { display: block; }
.theme-switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .theme-switch .track, .theme-switch .knob { transition: none; } }
@media (max-width: 640px) { .theme-bar { padding: 8px 16px 0; } }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 "Segoe UI", system-ui, sans-serif; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
       padding: 14px 24px; background: var(--panel); border-bottom: 1px solid var(--line); }
h1 { margin: 0; font-size: 18px; }

/* ---------- логотип и название организации (шапка, окно входа) */
.brand { display: flex; align-items: center; gap: 14px; }
.brand-logo { height: 44px; width: auto; flex-shrink: 0; }
.brand-name { margin: 0; font-size: 17px; font-weight: 700; line-height: 1.3; }
.brand-name small { display: block; margin-top: 1px; font-size: 12.5px; font-weight: 400; color: var(--muted); }
h2 { margin: 0; font-size: 22px; }
h3 { margin: 24px 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
main { max-width: 1280px; margin: 0 auto; padding: 20px 24px 60px; }
.sync { display: flex; align-items: center; gap: 12px; color: var(--muted); flex-wrap: wrap; }
.who { font-size: 13px; white-space: nowrap; }
/* max-width — без него текст #autoInfo (одна строка без переноса: это flex-item в столбце с align-items: flex-end,
   значит без заданной ширины он растягивается точно по содержимому) рвал вёрстку шапки, когда автообновление
   добавляет длинное пояснение («Плановое обновление пропущено: приложение было выключено…», см.
   autoText() в app.js) — теперь такой текст переносится на несколько строк вместо того, чтобы расширять шапку. */
.syncinfo { display: flex; flex-direction: column; align-items: flex-end; text-align: right; max-width: min(560px, 55vw); }
.syncinfo small { font-size: 12px; }
.hover-info { position: relative; }
.datebtn { background: none; color: inherit; padding: 0; border-radius: 2px; font: inherit; text-align: right;
           text-decoration: underline dotted; text-underline-offset: 3px; cursor: help; }
.datebtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.popover { display: none; position: fixed; right: 16px; top: var(--pop-top, 64px); z-index: 2000; width: min(680px, calc(100vw - 32px));
           max-height: calc(100vh - var(--pop-top, 64px) - 16px); overflow: auto;
           padding: 12px 14px; text-align: left; color: var(--text); background: var(--panel); border: 1px solid var(--line);
           border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.28); font-size: 12px; }
.popover::before { content: ""; position: absolute; left: 0; right: 0; top: -8px; height: 8px; }   /* не даёт окну закрыться, пока курсор идёт к нему */
.hover-info:hover .popover, .hover-info:focus-within .popover { display: block; }
.popover h4 { margin: 0 0 8px; font-size: 13px; }
.popover table { font-size: 12px; }
.popover th { position: static; }
.popover .warn { color: var(--error); }
.popover .ok { color: var(--ok-fg); }
.popover .foot { margin: 8px 0 0; color: var(--muted); }

/* дата формирования загруженного отчёта ЕГИСЗ старше STALE_REPORT_DAYS (app/web/app.js) — тот же цвет, что и у
   предупреждений устаревания справочников НСИ/выгрузок Минздрава (.popover .warn), для единого языка приложения */
.stale-date { color: var(--error); font-weight: 600; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 20px; }
.modes { display: flex; gap: 20px; margin-bottom: 14px; font-weight: 600; flex-wrap: wrap; }
.row { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; margin-top: 10px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 220px; position: relative; color: var(--muted); font-size: 12px; }
.field.grow { flex: 1; }
.check { display: flex; gap: 6px; align-items: center; }
.spacer { flex: 1; }
select, input:not([type=checkbox]):not([type=radio]) { font: inherit; padding: 8px 10px; border: 1px solid var(--line);
                              border-radius: 6px; background: var(--panel); color: var(--text); width: 100%; }
select:focus, input:not([type=checkbox]):not([type=radio]):focus { outline: none; border-color: var(--accent);
                              box-shadow: 0 0 0 3px var(--accent-soft); }
button, .btn { font: inherit; padding: 8px 18px; border: 0; border-radius: 6px; background: var(--accent);
               color: var(--accent-text); cursor: pointer; text-decoration: none; display: inline-block; }
button.secondary, .btn.secondary { background: var(--accent-soft); color: var(--accent); }
button:hover:not(:disabled), .btn:hover { filter: brightness(1.08); }
button:active:not(:disabled) { filter: brightness(.95); }
button:disabled { opacity: .5; cursor: default; }
button:focus-visible, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.suggest { position: absolute; top: 100%; left: 0; right: 0; z-index: 5; margin: 2px 0 0; padding: 4px; list-style: none;
           background: var(--panel); border: 1px solid var(--line); border-radius: 6px; max-height: 320px; overflow: auto;
           box-shadow: 0 8px 24px rgba(0,0,0,.15); }
.suggest li { padding: 6px 8px; border-radius: 4px; cursor: pointer; display: flex; flex-direction: column; color: var(--text); font-size: 14px; }
.suggest li:hover { background: var(--accent-soft); }
.suggest small { color: var(--muted); }
.suggest li.none { cursor: default; color: var(--muted); }
.error { color: var(--error); margin: 10px 0 0; }
.hint { color: var(--muted); font-size: 12px; margin: 4px 0; }
.result-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.actions { display: flex; gap: 8px; }
.profile { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px 24px; margin: 16px 0;
           padding: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.profile div { display: flex; flex-direction: column; }
.profile span { color: var(--muted); font-size: 12px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
/* ---------- разделы сводки: «Справочная информация» (вложенные подразделы НСИ) и раздел на каждый показатель
   (карточки + таблицы по организациям + динамика). Цвет раздела — есть ли отклонение от плана (planState в app.js). */
.section > summary { font-size: 15px; }
.section[open] > summary { border-bottom: 1px solid var(--line); }
.section-body { padding: 12px 14px 4px; }
.section-body > .cards { margin-bottom: 12px; }
.section-tools { display: flex; justify-content: flex-end; margin-bottom: 10px; }
.section-tools .btn { padding: 5px 12px; font-size: 13px; text-decoration: none; }
.section-body > details { margin-bottom: 8px; }
.section .section > summary { font-size: 14px; }                 /* подразделы внутри «Справочной информации» */
.section.reference > summary { color: var(--accent); }
.section.dev { border-color: var(--bad-line); border-left: 5px solid var(--error); }
.section.dev > summary { background: color-mix(in srgb, var(--bad-bg) 55%, transparent); }
.section.ok { border-color: var(--ok-line); border-left: 5px solid var(--ok-fg); }
.section.ok > summary { background: color-mix(in srgb, var(--ok-bg) 55%, transparent); }
.section.dev > summary, .section.ok > summary { border-radius: 5px 9px 0 0; }
.section.dev:not([open]) > summary, .section.ok:not([open]) > summary { border-radius: 5px 9px 9px 5px; }
.plan-chip { display: inline-block; margin-left: 10px; padding: 1px 10px; border-radius: 10px; font-size: 12px; vertical-align: 1px; }
.plan-chip.dev { background: var(--bad-bg); color: var(--bad-fg); border: 1px solid var(--bad-line); }
.as-of { float: right; margin-left: 12px; font-size: 13px; font-weight: 400; color: var(--muted); white-space: nowrap; }
.plan-chip.ok { background: var(--ok-bg); color: var(--ok-fg); border: 1px solid var(--ok-line); }
/* ---------- таблица в окне фиксированной высоты: прокрутка внутри, шапка закреплена, сортировка и фильтр (grid.js) */
.grid { max-height: 440px; overflow: auto; border: 1px solid var(--line); border-radius: 8px;
        scrollbar-color: var(--line) transparent; }
.grid table { border-collapse: separate; border-spacing: 0; }
.grid th { z-index: 1; box-shadow: inset 0 -1px 0 var(--line); }
.th-in { display: inline-flex; align-items: center; gap: 2px; }
th.num .th-in { flex-direction: row; justify-content: flex-end; }
.th-sort, .th-filter { padding: 2px 4px; border-radius: 4px; background: none; color: inherit; font: inherit; font-weight: 600; }
.th-sort:hover, .th-filter:hover { background: var(--accent-soft); color: var(--accent); }
.th-filter { padding: 2px 6px; font-size: 11px; color: var(--muted); }
th.sorted .th-sort, th.filtered .th-filter { color: var(--accent); }
th.filtered .th-filter { background: var(--accent-soft); }
.grid-status { display: flex; gap: 6px; align-items: center; }
.linkbtn { padding: 0; background: none; color: var(--accent); text-decoration: underline; font: inherit; cursor: pointer; }
.grid-pop { position: fixed; z-index: 1000; width: 300px; padding: 10px; background: var(--panel); color: var(--text);
            border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.28); font-size: 13px; }
.grid-pop .gp-sort { display: flex; gap: 6px; margin-bottom: 8px; }
.grid-pop .gp-sort button { flex: 1; padding: 5px 8px; font-size: 12px; }
.grid-pop .gp-search { margin-bottom: 6px; }
.grid-pop label { display: flex; align-items: center; gap: 8px; padding: 3px 4px; border-radius: 4px; cursor: pointer; }
.grid-pop label:hover { background: var(--accent-soft); }
.grid-pop label[hidden] { display: none; }
.grid-pop label span { flex: 1; overflow-wrap: anywhere; }
.grid-pop label small { color: var(--muted); font-variant-numeric: tabular-nums; }
.grid-pop .gp-all { border-bottom: 1px solid var(--line); border-radius: 0; margin-bottom: 4px; padding-bottom: 6px; }
.grid-pop .gp-list { max-height: 240px; overflow: auto; }
.grid-pop .gp-actions { display: flex; gap: 6px; margin-top: 8px; }
.grid-pop .gp-actions button { flex: 1; padding: 6px 8px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.card .value { font-size: 24px; font-weight: 600; }
.card .value small { font-size: 12px; color: var(--muted); font-weight: 400; }
.card .label { color: var(--muted); font-size: 12px; }
.card.status .value { font-size: 18px; }
.card.status.ok { background: var(--ok-bg); border-color: var(--ok-line); }
.card.status.ok .value { color: var(--ok-fg); }
.card.status.bad { background: var(--bad-bg); border-color: var(--bad-line); }
.card.status.bad .value { color: var(--bad-fg); }
/* ---------- цветовая индикация выполнения плана (ФЭР/РЭМД/ТВСП СЭМД, доля врачей) — пороги см. Metric.thresholds */
.card.band-green { background: var(--ok-bg); border-color: var(--ok-line); }
.card.band-green .value { color: var(--ok-fg); }
.card.band-yellow { background: var(--warn-bg); border-color: var(--warn-line); }
.card.band-yellow .value { color: var(--warn-fg); }
.card.band-orange { background: var(--orange-bg); border-color: var(--orange-line); }
.card.band-orange .value { color: var(--orange-fg); }
.card.band-red { background: var(--bad-bg); border-color: var(--bad-line); }
.card.band-red .value { color: var(--bad-fg); }
details { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; }
summary { padding: 10px 14px; cursor: pointer; font-weight: 600; }
details > .hint, details > .scroll { margin: 0 14px 12px; }
.badge { background: var(--accent-soft); color: var(--accent); border-radius: 10px; padding: 1px 8px; font-size: 12px; margin-left: 6px; }
.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-weight: 600; white-space: nowrap; position: sticky; top: 0; background: var(--panel); }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
th.num { text-align: right; }   /* заголовок числового столбца — тем же краем, что и значения под ним (td.num) */
a { color: var(--accent); }
.mapbox { margin: 16px 0; }
.maptools { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; margin: 0 14px 8px; }
.legend { margin-left: auto; color: var(--muted); font-size: 12px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin: 0 4px 0 10px; vertical-align: -1px; }
.dot.hosp { background: #d9482b; } .dot.amb { background: #2b7bd9; } .dot.none { background: #8a93a3; } .dot.bld { background: #7a5cc7; }
#map { height: 480px; margin: 0 14px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--accent-soft); }
.mapbox > .hint, .mapbox > details { margin-left: 14px; margin-right: 14px; }
.popup { display: flex; flex-direction: column; gap: 4px; max-width: 260px; }
.popup small { color: #667085; }
.mapfilters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 0 14px 8px; }
/* фильтры «Тип»/«Вид» подразделения относятся только к слою «Здания подразделений» — при выключенном слое неактивны;
   строки «Найдено»/«Показатель» (#mapMatched/#mapMz) в том же контейнере это не затрагивает */
.mapfilters.disabled #ddType, .mapfilters.disabled #ddKind, .mapfilters.disabled #filtersReset { opacity: .5; pointer-events: none; }
.dd { position: relative; margin: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.dd > summary { padding: 6px 12px; font-weight: 400; }
.dd > summary b { font-weight: 600; }
.dd[open] { border-color: var(--accent); }
.dd-panel { position: absolute; z-index: 1100; top: calc(100% + 4px); left: 0; min-width: 300px; max-width: 92vw; padding: 8px;
            background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.28); }
.dd-panel.wide { width: 440px; }
.dd-panel input[type=search] { margin-bottom: 6px; }
.matched { margin-left: auto; color: var(--muted); }
.matched b { color: var(--text); font-variant-numeric: tabular-nums; }
.optlist { max-height: 300px; overflow: auto; }
.opt { display: flex; gap: 8px; align-items: baseline; padding: 4px 6px; border-radius: 4px; cursor: pointer; }
.opt:hover { background: var(--accent-soft); }
.opt span { flex: 1; }
.opt small { color: var(--muted); font-variant-numeric: tabular-nums; }
@media (max-width: 640px) { main { padding: 12px 16px 40px; } .top { padding: 12px 16px; } }
@media print {
  body { background: #fff; color: #000; font-size: 11px; }
  .no-print, .top, .mapbox, #closeCard { display: none !important; }
  details { border: 0; } details > * { display: block; }
  .grid { max-height: none; overflow: visible; border: 0; }
  .th-filter, .grid-status, .grid-pop { display: none !important; }
  main { padding: 0; max-width: none; }
  .card, .profile, details { break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
}

/* ---------- фильтр ведомственной принадлежности */
.field.dept { flex: 1 1 320px; min-width: 240px; }
.field.dept select { text-overflow: ellipsis; }

/* ---------- сигнальная информация: выделена красным */
.group.signal { margin-top: 28px; padding: 4px 16px 12px; border: 1px solid var(--bad-line); border-left: 5px solid var(--error);
                border-radius: 10px; background: color-mix(in srgb, var(--bad-bg) 45%, transparent); }
.group.signal h3 { color: var(--error); }
/* подраздел-источник внутри сигнальной информации (Metric.topic — общие проверки по организациям, ФЭР, РЭМД,
   каждый загруженный отчёт ЕГИСЗ) — не такой заметный, как h3 самого блока, но крупнее обычного текста */
.group.signal h4 { margin: 14px 0 6px; font-size: 13px; color: var(--bad-fg); }
.group.signal h4:first-of-type { margin-top: 4px; }
.group.signal .card { background: var(--bad-bg); border-color: var(--bad-line); }
.group.signal .card .value { color: var(--bad-fg); }
.group.signal details { border-color: var(--bad-line); }
.group.signal summary { color: var(--bad-fg); }
.group.signal .badge { background: var(--bad-bg); color: var(--bad-fg); }
.group.signal .hint { color: var(--bad-fg); }
.signal-block { margin-bottom: 10px; }
.signal-block > summary { font-size: 15px; }
.signal-block[open] > summary { border-bottom: 1px solid var(--bad-line); }
.signal-block-body { padding: 4px 14px 4px; }
.signal-block-body > details { margin-bottom: 8px; }
.block-count { float: right; margin-left: 12px; }       /* число разделов блока — у правого края заголовка */
.signal-title { color: var(--error); }

/* ---------- окно справки */
/* overflow: hidden — у <dialog> по умолчанию своя прокрутка (overflow: auto в UA-стилях браузера); без этой строки
   при большом содержимом получались две полосы прокрутки сразу — у самого <dialog> (на пару пикселей — округление
   flex-раскладки) и у .help-body (собственно нужная). Прокручиваться должен только .help-body. */
dialog.help { width: min(1040px, 94vw); max-height: 92vh; padding: 0; color: var(--text); background: var(--panel);
              border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.45); overflow: hidden; }
dialog.help::backdrop { background: rgba(0, 0, 0, .55); }
.help-inner { display: flex; flex-direction: column; max-height: 92vh; }
.help-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 20px;
             border-bottom: 1px solid var(--line); }
.help-head h2 { font-size: 18px; }
.help-body { padding: 4px 24px 24px; overflow: auto; line-height: 1.55; }
.help-body h3 { margin: 26px 0 8px; font-size: 16px; text-transform: none; letter-spacing: 0; color: var(--text); scroll-margin-top: 8px; }
.help-body h4 { margin: 18px 0 6px; font-size: 14px; }
.help-body p, .help-body ul { margin: 6px 0; }
.help-body ul { padding-left: 20px; }
.help-body li { margin: 4px 0; }
.help-body dt { margin-top: 10px; font-weight: 600; }
.help-body dd { margin: 3px 0 0 0; }
.help-body code { padding: 1px 5px; border-radius: 4px; background: var(--accent-soft); font-size: 12px; overflow-wrap: anywhere; }
.help-toc { position: sticky; top: 0; z-index: 1; display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 10px 0; margin: 0 0 4px;
            background: var(--panel); border-bottom: 1px solid var(--line); font-size: 13px; }
.help-table { font-size: 12.5px; }
.help-table th { position: static; }
.help-table td:first-child { min-width: 160px; }

.group.signal .cards { margin: 4px 0 12px; }

/* ---------- карточка организации: шапка с кнопкой закрытия */
.profile-head { grid-column: 1 / -1; display: flex !important; flex-direction: row !important; justify-content: space-between;
                align-items: center; gap: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.profile-head b { font-size: 14px; }

/* ---------- показатели Минздрава: нейтральная плашка, легенда карты, график динамики */
.card.status.na { background: color-mix(in srgb, var(--muted) 12%, transparent); border-color: var(--line); }
.card.status.na .value { color: var(--muted); }
.dot.mzok { background: #2e9e5b; } .dot.mzbad { background: #d9482b; } .dot.mzextra { background: #6b7c93; }
/* легенда слоя «Доля врачей» — цвет зоны доли, а не план/факт; значения должны совпадать с BAND_COLORS в map.js */
.dot.bandgreen { background: #2e9e5b; } .dot.bandyellow { background: #d9b42e; }
.dot.bandorange { background: #d97a2b; } .dot.bandred { background: #d9482b; }
.mzsel { display: inline-flex; gap: 8px; align-items: center; color: var(--muted); }
.mzsel[hidden] { display: none; }
#mzLayer { width: auto; max-width: 360px; }
.chart { margin: 4px 14px 10px; }
.chart svg { width: 100%; max-width: 720px; height: auto; }
.chart text { fill: var(--muted); font-size: 11px; }
.chart .axis { stroke: var(--line); stroke-width: 1; }
.chart .plan { stroke: var(--muted); stroke-width: 2; stroke-dasharray: 6 4; }
.chart .fact { stroke: var(--accent); stroke-width: 2.4; }
.chart .fact-dot { fill: var(--accent); }
.chart figcaption { font-size: 12px; color: var(--muted); }
.swatch { display: inline-block; width: 22px; height: 0; vertical-align: middle; margin: 0 4px 0 12px; border-top: 3px solid var(--accent); }
.swatch.plan { border-top: 3px dashed var(--muted); }

/* ---------- легенда показателя Минздрава: цветовые зоны кликабельны (фильтр по зоне) */
.legend.mz { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-left: 0; }
.legend-item { display: inline-flex; align-items: center; gap: 4px; border: 1px solid transparent; background: none;
               padding: 2px 8px 2px 4px; border-radius: 12px; font: inherit; font-size: 12px; color: var(--muted); cursor: pointer; }
.legend-item .dot { margin: 0; }
.legend-item:hover { background: var(--accent-soft); color: var(--text); }
.legend-item.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }

/* ---------- слои «Организации»/«Здания подразделений» недоступны, пока выбран показатель Минздрава (и наоборот) */
.check.disabled { opacity: .5; cursor: not-allowed; }
.check.disabled input { cursor: not-allowed; }

/* ---------- инструменты карты: линейка, радиус, полный экран */
.leaflet-bar.map-tools a { display: flex; align-items: center; justify-content: center; background: var(--panel); color: var(--text); }
.leaflet-bar.map-tools a:hover { background: var(--accent-soft); }
.leaflet-bar.map-tools a.active { background: var(--accent); color: var(--accent-text); }
.leaflet-container.tool-active { cursor: crosshair; }
.leaflet-tooltip.tool-tip { font-weight: 600; }
/* подсказка слоя «Показатель» — три строки (МО, здание/подразделение, план/факт); Leaflet по умолчанию не переносит
   текст (white-space: nowrap), здесь это снято, чтобы длинное название здания уходило на следующую строку */
/* подсказка расширяется по содержимому, чтобы название МО (первая строка, см. mzTooltip/doctorsTooltip/countTooltip/
   buildingTooltip в map.js) обычно помещалось в одну строку; длиннее max-width — переносится внутри рамки, а не
   вылезает за неё (раньше первая строка была nowrap при ширине 230px и длинные названия торчали наружу) */
.leaflet-tooltip.mz-tip { white-space: normal; width: max-content; max-width: min(420px, 80vw); line-height: 1.4; }
.leaflet-tooltip.mz-tip b { overflow-wrap: anywhere; }
/* полноэкранный режим — на весь экран уходит вся панель (карта + переключатели слоёв + фильтры), а не только сама карта,
   иначе они остаются вне полноэкранного элемента и становятся недоступны */
.map-canvas:fullscreen, .map-canvas:-webkit-full-screen {
  display: flex; flex-direction: column; background: var(--bg); padding: 10px 14px;
}
.map-canvas:fullscreen .maptools, .map-canvas:-webkit-full-screen .maptools,
.map-canvas:fullscreen .mapfilters, .map-canvas:-webkit-full-screen .mapfilters { margin: 0 0 8px; flex: 0 0 auto; }
.map-canvas:fullscreen #map, .map-canvas:-webkit-full-screen #map { flex: 1 1 auto; height: auto !important; margin: 0; }

/* ---------- скрыт флажок из стандартной подписи Leaflet 1.9.4; подпись OpenStreetMap остаётся */
.leaflet-attribution-flag { display: none !important; }

/* ключ загрузки робота ЕГИСЗ: показывается один раз сразу после выпуска */
.new-key { margin-top: 10px; padding: 10px 14px; }
.new-key input { width: 100%; font-family: monospace; }
#reportsLogBox { margin-top: 14px; }
#reportsLogBox tr.log-error td:last-child b { color: var(--error); }

/* привязка учётной записи «Пользователь» к организациям (Администрирование → учётные записи МО) */
.mo-picker { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.mo-picker-label { color: var(--muted); font-size: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 2px; max-width: 100%; padding: 3px 4px 3px 10px; border-radius: 999px;
        background: var(--accent-soft); color: var(--text); font-size: 13px; }
.chip button { padding: 0 6px; background: transparent; color: var(--muted); font-size: 16px; line-height: 1; }
.mo-editor { margin-top: 10px; }
.mo-editor h4 { margin: 0 0 4px; }
td.account-mo { font-size: 13px; min-width: 180px; }
td.account-mo button { margin-top: 4px; padding: 4px 10px; }
.mo-first { display: inline-flex; align-items: center; gap: 6px; }
.mo-more { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 6px;
           border-radius: 999px; background: var(--accent); color: var(--accent-text); font-size: 11px; font-weight: 600; }
.mo-missing { color: var(--error); font-weight: 600; }

/* раскрытие строки организации (таблицы с Metric.detail, app.js: toggleRowDetail) — таблица врачей «Доли врачей» */
.row-toggle { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 0 6px 0 0; font-size: 1em; line-height: 1; min-width: 0; }
.row-toggle:hover { color: var(--text); }
tr.row-detail > td { padding: 6px 10px 12px; white-space: normal; background: var(--bg); }

/* список врачей (таблица с gap_when): красные — не выполнили показатель, зелёные — выполнили; быстрый фильтр над ней */
tr.row-bad > td { background: color-mix(in srgb, var(--bad-bg) 70%, transparent); color: var(--bad-fg); }
tr.row-good > td { background: color-mix(in srgb, var(--ok-bg) 55%, transparent); color: var(--ok-fg); }
.status-filter { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 8px; }
.status-filter button { padding: 4px 10px; font-size: 13px; border: 1px solid var(--line); background: transparent; color: var(--text); }
.status-filter button.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.status-filter button.bad.active { border-color: var(--bad-line); background: var(--bad-bg); color: var(--bad-fg); }
.status-filter button.good.active { border-color: var(--ok-line); background: var(--ok-bg); color: var(--ok-fg); }
.grid.nested { max-height: 360px; }
details > .status-filter { margin: 0 14px 10px; }   /* как у подсказки и окна таблицы рядом (details > .hint/.scroll) */

/* дата актуальности у роли без status_view: просто надпись, без всплывающего окна и без вида кнопки-ссылки */
.datebtn.static { cursor: default; text-decoration: none; pointer-events: none; }
