/* СИГНАЛ — viewer cabinet v3: unified components (.u-*) and the screens built on them.
   Our look: black / light tokens from app.css, square surfaces, pills for chips. Only #/watch uses these classes. */

:root { --u-ease: cubic-bezier(.2, .8, .2, 1); --u-h: 38px; --u-accent: var(--fg); --u-raised: var(--bg-3); }
:root[data-theme="light"] { --u-raised: #ebebe7; }

/* ---------------------------------------------------------------- numbers */
.u-dash { color: var(--muted); }
.u-nobase { color: var(--muted); font-size: .86em; white-space: nowrap; }
.u-delta { white-space: nowrap; font-variant-numeric: tabular-nums; }
.u-delta.is-up { color: var(--bad); }
.u-delta.is-down { color: var(--ok); }
.u-delta.is-flat { color: var(--muted); }
.u-cu { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------------------------------------------------------------- Button */
.u-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: var(--u-h); padding: 0 14px;
  border: 1px solid var(--line-2); background: transparent; color: var(--fg); font: inherit; font-size: 14px; line-height: 1; white-space: nowrap; cursor: pointer;
  transition: background-color 140ms, border-color 140ms, color 140ms, transform 120ms, opacity 140ms; }
.u-btn .wico { flex: none; }
.u-btn:active:not(:disabled):not([aria-disabled="true"]) { transform: scale(.98); }
.u-btn:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
.u-btn--secondary:hover:not(:disabled) { background: var(--u-raised); border-color: var(--muted); }
.u-btn--primary { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.u-btn--primary:hover:not(:disabled) { background: color-mix(in srgb, var(--fg) 84%, var(--bg)); border-color: color-mix(in srgb, var(--fg) 84%, var(--bg)); }
.u-btn--ghost { border-color: transparent; }
.u-btn--ghost:hover:not(:disabled) { background: var(--u-raised); }
.u-btn--icon { width: var(--u-h); padding: 0; }
.u-btn:disabled { opacity: .5; cursor: not-allowed; }
.u-btn[aria-disabled="true"] { opacity: .7; cursor: progress; }
.u-btn__after { margin-left: 2px; transition: transform 140ms; }
.u-menubtn[aria-expanded="true"] .u-btn__after { transform: rotate(180deg); }

/* ---------------------------------------------------------------- Segmented */
.u-seg { position: relative; display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border: 1px solid var(--line-2); background: var(--bg-2); max-width: 100%; isolation: isolate; }
.u-seg__thumb { position: absolute; left: 0; top: 0; z-index: -1; background: var(--fg); opacity: 0; pointer-events: none;
  transition: transform 200ms var(--u-ease), width 200ms var(--u-ease), height 200ms var(--u-ease), opacity 140ms; }
.u-seg__i { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 32px; padding: 0 12px; border: 1px solid transparent;
  background: none; color: var(--fg-2); font: inherit; font-size: 13px; white-space: nowrap; cursor: pointer; transition: color 140ms, border-color 140ms, background-color 140ms; }
.u-seg__i:hover { color: var(--fg); }
.u-seg__i:focus-visible { outline: 2px solid var(--fg); outline-offset: 1px; }
.u-seg__i.is-on { color: var(--bg); background: var(--fg); }               /* before hydration */
.u-seg.is-hydrated .u-seg__i.is-on { background: transparent; }
.u-seg__i.is-open:not(.is-on) { border-color: var(--line-2); color: var(--fg); }
.u-seg--full { display: grid; grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); width: 100%; }
.u-seg--lg .u-seg__i { min-height: 40px; font-size: 15px; }

/* ---------------------------------------------------------------- popovers */
.u-period, .u-menuwrap, .u-select { position: relative; max-width: 100%; }
.u-pop { --dx: 0px; position: absolute; z-index: 60; left: 0; top: calc(100% + 6px); background: var(--bg-2); border: 1px solid var(--line-2);
  box-shadow: 0 18px 48px color-mix(in srgb, #000 35%, transparent); transform: translateX(var(--dx)); animation: uPopIn 160ms var(--u-ease) both; }
.u-pop--bottom-end { left: auto; right: 0; }
.u-pop--top-end { left: auto; right: 0; top: auto; bottom: calc(100% + 6px); transform-origin: 100% 100%; }
.u-pop.is-out { animation: uPopOut 120ms ease-in both; }
@keyframes uPopIn { from { opacity: 0; transform: translate(var(--dx), 6px) scale(.98); } }
@keyframes uPopOut { to { opacity: 0; transform: translate(var(--dx), 4px) scale(.98); } }

/* ---------------------------------------------------------------- RangeCalendar */
.u-cal { padding: 12px; width: 300px; max-width: calc(100vw - 32px); }
.u-cal__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.u-cal__title { margin: 0; font-size: 14px; font-weight: 500; }
.u-cal__nav { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid transparent; background: none; color: var(--fg-2); cursor: pointer; transition: background-color 140ms, color 140ms; }
.u-cal__nav:hover:not(:disabled) { background: var(--u-raised); color: var(--fg); }
.u-cal__nav:disabled { opacity: .35; cursor: not-allowed; }
.u-cal__wd, .u-cal__row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.u-cal__wd span { text-align: center; font-family: var(--mono); font-size: 11px; color: var(--muted); padding: 4px 0; }
.u-cal__row > span { display: grid; }
.u-cal__d { height: 36px; border: 1px solid transparent; background: none; color: var(--fg); font: inherit; font-size: 13px; font-variant-numeric: tabular-nums; cursor: pointer; transition: background-color 140ms, color 140ms, border-color 140ms; }
.u-cal__d:hover:not(:disabled) { border-color: var(--line-2); }
.u-cal__d:focus-visible { outline: 2px solid var(--fg); outline-offset: -2px; }
.u-cal__d.is-today { text-decoration: underline; text-underline-offset: 3px; }
.u-cal__d.is-in { background: color-mix(in srgb, var(--fg) 12%, transparent); }
.u-cal__d.is-edge { background: var(--fg); color: var(--bg); }
.u-cal__d:disabled { color: var(--faint); cursor: not-allowed; }
.u-cal__hint { margin: 8px 2px 0; font-size: 12px; color: var(--muted); }

/* ---------------------------------------------------------------- Menu / Select */
.u-menu { padding: 6px; min-width: 280px; display: grid; gap: 2px; }
.u-menu__i { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 10px; border: 0; background: none; color: var(--fg); font: inherit; text-align: left; cursor: pointer; transition: background-color 140ms; }
.u-menu__i:hover, .u-menu__i:focus-visible { background: var(--u-raised); outline: none; }
.u-menu__ico { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line-2); color: var(--fg-2); flex: none; }
.u-menu__txt { display: grid; gap: 2px; }
.u-menu__title { font-size: 14px; }
.u-menu__hint { font-size: 12px; color: var(--muted); }
.u-select__btn { display: inline-flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 160px; height: 34px; padding: 0 10px; border: 1px solid var(--line-2); background: var(--bg-2); color: var(--fg); font: inherit; font-size: 13px; cursor: pointer; transition: border-color 140ms; }
.u-select__btn:hover { border-color: var(--muted); }
.u-select__btn[aria-expanded="true"] { border-color: var(--fg); }
.u-select__v { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.u-listbox { padding: 4px; min-width: 200px; max-height: 300px; overflow-y: auto; outline: none; }
.u-listbox__o { display: flex; align-items: center; gap: 8px; padding: 8px 10px; font-size: 13px; color: var(--fg-2); cursor: pointer; }
.u-listbox__o.is-act { background: var(--u-raised); color: var(--fg); }
.u-listbox__o.is-sel { color: var(--fg); }
.u-listbox__chk { width: 16px; flex: none; display: grid; }

/* ---------------------------------------------------------------- SearchField */
.u-search { position: relative; display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 4px 0 12px; border: 1px solid var(--line-2); background: var(--bg-2); color: var(--muted); transition: border-color 140ms; min-width: 0; }
.u-search:hover { border-color: var(--muted); }
.u-search:focus-within { border-color: var(--fg); outline: 1px solid var(--fg); }
.u-search__in { flex: 1; min-width: 0; height: 100%; background: none; border: 0; outline: none; font-size: 14px; color: var(--fg); padding: 0; }
.u-search__in::placeholder { color: var(--faint); }
.u-search__x { display: grid; place-items: center; width: 32px; height: 32px; border: 0; background: none; color: var(--muted); cursor: pointer; flex: none; transition: color 140ms, background-color 140ms; }
.u-search__x:hover { color: var(--fg); background: var(--u-raised); }
.u-search__kbd { font-family: var(--mono); font-size: 11px; color: var(--muted); border: 1px solid var(--line-2); padding: 1px 6px; margin-right: 6px; white-space: nowrap; }

/* ---------------------------------------------------------------- ChoiceCard */
.u-choice { display: flex; align-items: center; gap: 14px; text-align: left; border: 1px solid var(--line-2); background: var(--bg); color: var(--fg); font: inherit; cursor: pointer; min-width: 0;
  transition: background-color 140ms, border-color 140ms, color 140ms, box-shadow 140ms, transform 120ms; }
.u-choice:hover { border-color: var(--muted); background: var(--bg-2); }
.u-choice:active { transform: scale(.98); }
.u-choice:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
.u-choice.is-on { border-color: var(--u-accent); background: var(--bg-2); box-shadow: inset 0 0 0 1px var(--u-accent); }
.u-choice--card { min-height: 64px; padding: 12px 14px; }
.u-choice__ico { display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--line-2); color: var(--fg-2); flex: none; }
.u-choice.is-on .u-choice__ico { color: var(--fg); border-color: var(--fg); }
.u-choice__txt { display: grid; gap: 3px; min-width: 0; }
.u-choice__title { font-size: 15px; font-weight: 500; overflow-wrap: anywhere; }
.u-choice__sub { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.u-choice--chip { min-height: 36px; padding: 0 14px; border-radius: 999px; gap: 8px; font-size: 14px; }
.u-choice--chip.is-on { background: var(--fg); color: var(--bg); box-shadow: none; }
.u-choices { display: grid; gap: 10px; }
.u-choices--card { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.u-choices--chip { display: flex; flex-wrap: wrap; gap: 8px; }
.u-choice--stat { flex-direction: column; align-items: stretch; gap: 10px; padding: 16px 18px 14px; }

/* ---------------------------------------------------------------- ChipNav */
.u-chips { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
.u-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 999px; color: var(--fg-2); font-size: 13px; white-space: nowrap; transition: color 140ms, border-color 140ms, background-color 140ms; }
.u-chip:hover { border-color: var(--fg); color: var(--fg); }
.u-chip.is-on { background: var(--fg); border-color: var(--fg); color: var(--bg); }
.u-chip.is-empty { opacity: .5; }
.u-chip.is-disabled { opacity: .4; cursor: not-allowed; }
.u-chip__n { font-family: var(--mono); font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.u-chip.is-on .u-chip__n { color: color-mix(in srgb, var(--bg) 65%, transparent); }

/* ---------------------------------------------------------------- Modal */
.u-modal { width: min(680px, calc(100vw - 16px)); max-width: calc(100vw - 16px); max-height: calc(100dvh - 32px); padding: 0; border: 1px solid var(--line-2); background: var(--bg-2); color: var(--fg); overflow: hidden;
  animation: uModalIn 220ms var(--u-ease) both; }
.u-modal[open] { display: flex; flex-direction: column; }
.u-modal::backdrop { background: rgba(0, 0, 0, .62); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); animation: uFade 220ms both; }
.u-modal.is-out { animation: uModalOut 150ms ease-in both; }
.u-modal.is-out::backdrop { animation: uFadeOut 150ms both; }
@keyframes uModalIn { from { opacity: 0; transform: scale(.96); } }
@keyframes uModalOut { to { opacity: 0; transform: scale(.96); } }
@keyframes uFade { from { opacity: 0; } }
@keyframes uFadeOut { to { opacity: 0; } }
.u-modal__box { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.u-modal__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 8px 24px; }
.u-modal__title { margin: 0; font-family: var(--font); font-size: 24px; font-weight: 500; letter-spacing: -.01em; }
.u-modal__body { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 24px 20px; }
.u-modal__foot { border-top: 1px solid var(--line); padding: 14px 24px 16px; }
@media (prefers-reduced-transparency: reduce) { .u-modal::backdrop { background: var(--bg); backdrop-filter: none; } }

/* ---------------------------------------------------------------- touch targets (§8) */
@media (max-width: 640px), (pointer: coarse) {
  :root { --u-h: 44px; }
  .u-seg__i { min-height: 44px; }
  .u-search { height: 44px; }
  .u-search__x { width: 44px; height: 44px; }
  .u-search__kbd { display: none; }
  .u-cal__d { height: 44px; }
  .u-cal__nav { width: 44px; height: 44px; }
  .u-choice--chip { min-height: 44px; }
  .u-chip { min-height: 44px; }
  .u-select__btn { height: 44px; }
  .u-menu__i { min-height: 56px; }
}

@media (prefers-reduced-motion: reduce) {
  .u-seg__thumb { transition: opacity 150ms; }
  .u-pop, .u-pop.is-out, .u-modal, .u-modal.is-out, .u-modal::backdrop { animation: uFade 150ms both; }
  .u-pop.is-out, .u-modal.is-out { animation-name: uFadeOut; }
  .u-btn, .u-choice { transition: background-color 150ms, border-color 150ms, color 150ms; }
  .u-btn:active, .u-choice:active { transform: none !important; }
}

/* ================================================================= screens */

/* sidebar «Отчёт» (a button that looks like an item) */
.wside__btn { width: 100%; background: none; border: 0; font: inherit; font-size: 14px; text-align: left; cursor: pointer; min-height: 40px; }
@media (max-width: 640px) { .wside__item { min-height: 44px; } }

/* ---------------------------------------------------------------- home: grid under the arms */
.countries--v3 { min-height: 0; }
.countries--v3 .countries__grid { align-items: start; }
.country--v3 { justify-content: flex-start; padding-bottom: 32px; }
.country__door { display: flex; flex-direction: column; align-items: center; gap: clamp(20px, 3vh, 36px); outline-offset: -6px; }
.country--v3 .country__arms { height: min(36vh, 330px); }
.country__door:hover .country__arms img, .country__door:focus-visible .country__arms img { filter: none; opacity: 1; transform: translateY(-6px) scale(1.02); }
.country__door:hover .country__name { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 6px; }
.country__more { width: min(100%, 520px); display: grid; gap: 14px; }
.country__more:empty { display: none; }
.country__empty { margin: 0; text-align: center; color: var(--warn); font-size: 14px; }
.cgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.cgrid__c { padding: 12px 14px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); min-width: 0; display: flex; flex-direction: column-reverse; justify-content: flex-end; gap: 4px; }
.cgrid__l { font-size: 12px; color: var(--muted); }
.cgrid__v { margin: 0; display: grid; gap: 2px; font-family: var(--font); font-size: 22px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.cgrid__v .u-nobase, .cgrid__v .u-delta { font-size: 18px; }
.cgrid__day { font-family: var(--text); font-size: 12px; color: var(--fg-2); }
.cgrid__day.is-flat, .cgrid__day.is-none { color: var(--muted); }
.csegs { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.csegs__a { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto auto; align-items: center; gap: 12px; min-height: 44px; padding: 6px 4px; border-bottom: 1px solid var(--line); color: var(--fg-2); font-size: 14px; transition: background-color 140ms, color 140ms; }
.csegs__a:hover { background: var(--bg-2); color: var(--fg); }
.csegs__ico { display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid var(--line-2); }
.csegs__t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--fg); }
.csegs__n { font-size: 12px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.csegs__n b { font-size: 14px; color: var(--fg); font-weight: 500; }
@media (max-width: 560px) {
  .country--v3 .country__arms { height: 22vh; }
  .cgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .csegs__a { grid-template-columns: 28px minmax(0, 1fr) auto; }
  .csegs__a .csegs__n:last-child { grid-column: 2 / -1; }
}

/* ---------------------------------------------------------------- shelf */
.seg__actions { display: flex; gap: 8px; }
.seg--v3 .seg__filters { margin: 18px 0 14px; }
.seg__tools { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 16px; margin: 6px 0 14px; }
.seg__searchcol { flex: 1 1 320px; max-width: 460px; min-width: 0; display: grid; gap: 6px; }
.seg__found { margin: 0; font-family: var(--mono); font-size: 12px; color: var(--muted); min-height: 1em; }
.seg__notice:empty { display: none; }
.seg__notice { margin-bottom: 12px; }

.seg__list { container-type: inline-size; container-name: shelf; min-width: 0; }
.sh { --cols: minmax(244px, 1fr) repeat(6, minmax(76px, 104px)); min-width: 0; }
.sh.is-busy .sh__body { opacity: .82; transition: opacity 200ms; }
.sh__table { border-top: 1px solid var(--line); }
.sh__hrow, .sh__row { display: grid; grid-template-columns: var(--cols); align-items: center; column-gap: 8px; }
.sh__hrow { border-bottom: 1px solid var(--line); }
.sh__hname { padding: 10px 0; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.sh__hcell { display: flex; justify-content: flex-end; }
.sh__sort { display: inline-flex; align-items: center; gap: 4px; min-height: 40px; padding: 0 2px; background: none; border: 0; color: var(--muted); font-family: var(--mono); font-size: 12px; cursor: pointer; text-align: right; transition: color 140ms; }
.sh__sort:hover, .sh__sort.is-on { color: var(--fg); }
.sh__sort:focus-visible, .sh__pill:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
.sh__arr { min-width: .8em; }
.sh__row { position: relative; padding: 10px 0; border-bottom: 1px solid var(--line); cursor: pointer; transition: background-color 140ms; contain-intrinsic-size: auto 61px; }
.sh__row:hover { background: color-mix(in srgb, var(--fg) 5%, transparent); }
.sh__who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.sh__id { display: grid; gap: 2px; min-width: 0; }
.sh__name { color: var(--fg); font-size: 15px; line-height: 1.3; overflow-wrap: anywhere; padding: 6px 0; margin: -6px 0; }
.sh__row:hover .sh__name { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.sh__pos { font-size: 12px; color: var(--muted); line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.sh__n { text-align: right; font-size: 16px; font-variant-numeric: tabular-nums; color: var(--fg-2); min-width: 0; }
.sh__n[data-k="total"] { color: var(--fg); font-weight: 500; }
.sh__l { display: none; }
.sh__v.is-swap { animation: uFade 200ms both; }
.sh__bar { display: none; }
.sh--sk .sh__row { cursor: default; }

/* narrow list: cards, the header becomes a «Сортировка:» row of pills */
@container shelf (max-width: 819px) {
  .sh__head { display: none; }
  .sh__bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 10px; }
  .sh__row { grid-template-columns: repeat(6, minmax(0, 1fr)); row-gap: 10px; padding: 12px 0; }
  .sh__who { grid-column: 1 / -1; }
  .sh__n { text-align: left; display: grid; gap: 2px; font-size: 15px; }
  .sh__l { display: block; font-size: 11px; color: var(--muted); font-weight: 400; line-height: 1.25; }
}
@container shelf (max-width: 659px) { .sh__row { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@container shelf (max-width: 380px) { .sh__row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  .sh__head { display: none; }
  .sh__bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 10px; }
  .sh__row { grid-template-columns: repeat(6, minmax(0, 1fr)); row-gap: 10px; padding: 12px 0; }
  .sh__who { grid-column: 1 / -1; }
  .sh__n { text-align: left; display: grid; gap: 2px; font-size: 15px; }
  .sh__l { display: block; font-size: 11px; color: var(--muted); font-weight: 400; line-height: 1.25; }
}
@media (max-width: 640px) { .sh__row { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.sh__bar-l { font-size: 12px; color: var(--muted); margin-right: 2px; }
.sh__pill { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 999px; background: none; color: var(--fg-2); font: inherit; font-size: 13px; cursor: pointer; transition: background-color 140ms, color 140ms, border-color 140ms; }
.sh__pill:hover { border-color: var(--fg); color: var(--fg); }
.sh__pill.is-on { background: var(--fg); color: var(--bg); border-color: var(--fg); }
@media (min-width: 641px) { .sh__pill { min-height: 34px; } }
@media (max-width: 640px) {
  .sh__name { padding: 12px 0; margin: -12px 0; }
  .seg__tools .u-period, .seg__tools .u-seg { width: 100%; }
  .seg__tools .u-seg { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .seg__tools .u-seg__i { grid-column: span 2; }
  .seg__tools .u-seg__i:nth-child(n + 5) { grid-column: span 3; }
  .seg__searchcol { max-width: none; flex-basis: 100%; }
  .wpage__row .seg__actions { width: 100%; }
}

/* metric panel period switch (shelf card) */
.mperiods { display: block; }
.mpanel .mrange__err { margin-top: 8px; }

/* ---------------------------------------------------------------- entity card: dossier */
.dos { margin: 14px 0 0; display: grid; gap: 6px; max-width: 760px; }
.dos__row { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 4px 16px; font-size: 14px; }
.dos__k { color: var(--muted); }
.dos__v { margin: 0; color: var(--fg-2); overflow-wrap: anywhere; }
.dos__nf { color: var(--muted); font-style: italic; }
@media (max-width: 640px) { .dos__row { grid-template-columns: minmax(0, 1fr); gap: 0; } .dos__row + .dos__row { margin-top: 6px; } }

/* ---------------------------------------------------------------- entity card: metrics */
.em { display: grid; gap: 14px; min-width: 0; }
.em__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.em__title { margin: 0; }
.em__cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.em__body { display: grid; gap: 8px; min-width: 0; }
.em__top { display: grid; gap: 2px; }
.em__name { font-size: 15px; font-weight: 500; color: var(--fg); }
.em__for { font-size: 13px; color: var(--muted); }
.em__fig { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; }
.em__num { font-family: var(--font); font-size: 36px; line-height: 1; font-weight: 400; letter-spacing: -.02em; }
.em__trend { font-size: 14px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.em__trend.is-bad { color: var(--bad); }
.em__trend.is-good { color: var(--ok); }
.em__trend.is-flat, .em__trend.is-none { color: var(--muted); }
.em__since { font-size: 12px; color: var(--muted); }
.em__mini { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--muted); }
.em__mi b { color: var(--fg-2); font-weight: 500; font-variant-numeric: tabular-nums; }
.em__mi.is-on b { color: var(--fg); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.em__sparkbox:empty { display: none; }
.em__spark { display: block; width: 100%; max-width: 220px; height: 28px; }
.em__bar { fill: color-mix(in srgb, var(--fg) 45%, transparent); }
.em__bar.is-zero { fill: color-mix(in srgb, var(--fg) 18%, transparent); }
.u-choice.is-on .em__bar { fill: var(--fg); }
.em__cov { font-size: 12px; color: var(--muted); }
.em[aria-busy="true"] .em__cards { opacity: .9; }
.em__panel { border: 1px solid var(--line-2); background: var(--bg-2); padding: 16px 18px; animation: rise 240ms var(--ease) both; }
@media (max-width: 760px) { .em__cards { grid-template-columns: minmax(0, 1fr); } .em__num { font-size: 30px; } }

.eml__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.eml__title { margin: 0; font-size: 16px; font-weight: 500; }
.eml__per { color: var(--muted); font-weight: 400; }
.eml__n { font-variant-numeric: tabular-nums; }
.eml__list { list-style: none; margin: 0; padding: 0; }
.eml__i { padding: 12px 0; border-top: 1px solid var(--line); display: grid; gap: 6px; }
.eml__meta { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; font-size: 12px; color: var(--muted); }
.eml__ch { display: inline-flex; align-items: center; gap: 6px; color: var(--fg-2); }
.eml__st { padding: 1px 8px; border: 1px solid var(--line-2); border-radius: 999px; }
.eml__st--deleted { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.eml__st--in_work { color: var(--info); border-color: color-mix(in srgb, var(--info) 40%, transparent); }
.eml__text { margin: 0; font-size: 14px; color: var(--fg-2); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.eml__text.is-empty { color: var(--muted); }
.eml__src, .eml__a { display: inline-flex; align-items: center; min-height: 32px; font-size: 13px; color: var(--fg); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; overflow-wrap: anywhere; justify-self: start; }
.eml__src:hover, .eml__a:hover { text-decoration-color: currentColor; }
.eml__links { margin: 0; display: flex; flex-wrap: wrap; gap: 4px 16px; }
.eml__nosrc, .eml__rm, .eml__proof { margin: 0; font-size: 12px; color: var(--muted); }
.eml__rm { color: var(--fg-2); }
.eml__empty { margin: 8px 0; font-size: 14px; color: var(--fg-2); }
.eml__note { margin: 6px 0; font-size: 13px; color: var(--muted); }
.eml__err { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.eml__err p { margin: 0; }
.eml__foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.eml__shown { margin: 0; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.eml__unvwrap { margin-top: 12px; display: grid; gap: 8px; justify-items: start; }
.eml__unv { width: 100%; }
@media (max-width: 640px) { .eml__src, .eml__a { min-height: 44px; } }

/* ---------------------------------------------------------------- feed grid (1/2/3 columns by feed width) */
.nfeed { container-type: inline-size; container-name: feed; }
.nlist--grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; align-items: stretch; }
@container feed (min-width: 600px) { .nlist--grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@container feed (min-width: 900px) { .nlist--grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.gcard { display: flex; flex-direction: column; gap: 10px; padding: 16px 16px 18px; }
.gcard .ntags { margin: 0; }
.gcard__src { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; align-self: flex-start; padding: 6px 10px; border: 1px solid var(--line-2); font-size: 13px; color: var(--fg); transition: background-color 140ms, color 140ms; }
a.gcard__src:hover { background: var(--fg); color: var(--bg); }
.gcard__srcname { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.gcard__host { font-family: var(--mono); font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.gcard__src:hover .gcard__host { color: inherit; }
.gcard__text { font-size: 14px; }
@container feed (max-width: 599px) { .gcard__text.is-clamped { -webkit-line-clamp: 3; } }
.gcard .nmore { align-self: flex-start; margin-top: -6px; }
.gcard__figs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.gcard__shot { margin: auto 0 0; display: grid; gap: 6px; }
.gcard__shotbtn { all: unset; display: block; cursor: zoom-in; aspect-ratio: 16 / 10; overflow: hidden; border: 1px solid var(--line); background: var(--bg-3); }
.gcard__shotbtn:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
.gcard__shotbtn img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.gcard__cap { font-size: 12px; color: var(--muted); }
.gcard__noshot { margin: auto 0 0; font-size: 12px; color: var(--faint); }
.gcard .ncard__open { margin-top: 0; }

/* ---------------------------------------------------------------- report dialog */
.rep { display: grid; gap: 22px; }
.rep__sec { display: grid; gap: 12px; min-width: 0; }
.rep__label { margin: 0; font-size: 13px; color: var(--muted); }
.rep__box { overflow: hidden; transition: height 200ms var(--u-ease); }
.rep__pane { display: grid; gap: 12px; padding: 2px; transition: opacity 180ms, transform 180ms; }
.rep__pane.is-leaving { opacity: 0; transform: translateY(-4px); transition-duration: 120ms; }
.rep__pane.is-entering { animation: repIn 180ms var(--u-ease) both; }
@keyframes repIn { from { opacity: 0; transform: translateY(5px); } }
.rep__cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.rep__flag { display: grid; place-items: center; width: 40px; height: 40px; flex: none; }
.rep__flag img { max-width: 100%; max-height: 100%; object-fit: contain; }
.rep__chipflag { width: 18px; height: 18px; object-fit: contain; }
.rep__warn { margin: 0; font-size: 13px; color: var(--warn); }
.rep__warn:empty { display: none; }
.rep__range { margin: 0; font-size: 13px; color: var(--fg-2); font-variant-numeric: tabular-nums; }
.rep__chosen { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border: 1px solid var(--u-accent); box-shadow: inset 0 0 0 1px var(--u-accent); background: var(--bg); }
.rep__chosen-id { flex: 1; min-width: 0; }
.rep__chosen-name { margin: 0; font-size: 15px; font-weight: 500; overflow-wrap: anywhere; }
.rep__chosen-sub { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.rep__sstatus { margin: 0; font-size: 12px; color: var(--muted); }
.rep__results { list-style: none; margin: 0; padding: 4px; border: 1px solid var(--line-2); max-height: 300px; overflow-y: auto; background: var(--bg); }
.rep__res { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 6px 8px; cursor: pointer; }
.rep__res.is-act { background: var(--u-raised); }
.rep__res-id { display: grid; min-width: 0; }
.rep__res-name { font-size: 14px; color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rep__res-sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rep__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; }
.rep__sumbox { min-width: 0; flex: 1 1 260px; }
.rep__sum { margin: 0; font-size: 15px; font-weight: 500; line-height: 1.35; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.rep__status { margin: 2px 0 0; font-size: 12px; color: var(--muted); min-height: 1.3em; }
.rep__actions { display: flex; gap: 8px; }
.rep__frame { position: fixed; right: 0; bottom: 0; width: 1px; height: 1px; border: 0; opacity: 0; pointer-events: none; }
.rep__ps .u-seg { display: flex; }
@media (max-width: 640px) {
  .rep__cards { grid-template-columns: minmax(0, 1fr); }
  .u-modal__body { padding: 6px 16px 16px; }
  .u-modal__head { padding: 14px 12px 6px 16px; }
  .u-modal__foot { padding: 12px 16px 14px; }
  .rep__actions { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .rep__actions .u-menuwrap, .rep__actions .u-btn { width: 100%; }
  .rep__scope.u-seg--full { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  .rep__box { transition: none; }
  .rep__pane, .rep__pane.is-leaving { transition: opacity 150ms; transform: none; }
  .rep__pane.is-entering, .em__panel { animation: none; }
}

/* grid containers must not grow past the viewport with wide content */
.em, .rep, .rep__sec, .rep__pane, .rep__picker, .eml, .u-choices { grid-template-columns: minmax(0, 1fr); }
.rep__cards.u-choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 640px) { .rep__cards.u-choices { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 560px) {
  .u-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter); }
  .u-chips::-webkit-scrollbar { display: none; }
}

/* touch targets of the viewer chrome (§8), ≤640 px only; the operations cabinet is not touched */
@media (max-width: 640px) {
  body.is-watch .themesw button { width: 44px; height: 40px; }
  body.is-watch .themesw button[data-mode="system"] { display: none; }
  body.is-watch .nav__brand { min-height: 44px; }
  body.is-watch .wq__field { height: 44px; }
  body.is-watch .nav__op { min-height: 44px; }
  .ptabs .wtab { min-height: 44px; align-items: center; padding: 0; }
  .ptabs { gap: 20px; }
  .iconbtn { width: 44px; height: 44px; }
  .wside__item { min-height: 44px; }
}

/* profile head with a dossier: avatar | name on top, dossier under the name; ≤480 px full width under both */
.prof__head--dos { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: clamp(16px, 2.4vw, 28px); align-items: start; }
.prof__head--dos > .wav { grid-row: 1 / span 2; }
.prof__dos { grid-column: 2; min-width: 0; }
.prof__dos .dos { margin-top: 12px; }
.dos__link { color: var(--fg); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
.dos__link:hover { text-decoration-color: currentColor; }
.dos__share { color: var(--muted); font-variant-numeric: tabular-nums; }
@media (max-width: 480px) {
  .prof__head--dos { align-items: center; }
  .prof__head--dos > .wav { grid-row: 1; }
  .prof__dos { grid-column: 1 / -1; }
}

/* shelf: platform filter note + «без подтверждения» under the «Удалено» card */
.seg__chan { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin: -4px 0 12px; padding: 8px 12px; border-left: 2px solid var(--fg); background: var(--bg-2); font-size: 13px; color: var(--fg-2); }
.seg__chan b { color: var(--fg); font-weight: 500; }
.seg__chan-x { display: inline-flex; align-items: center; min-height: 32px; color: var(--fg); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-2); }
@media (max-width: 640px) { .seg__chan-x { min-height: 44px; } }
.mcard__note { margin-top: -4px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
