/* МедДоп — каркас і компоненти робочих екранів */

/* ---------- Каркас ---------- */
.shell { display: grid; grid-template-columns: 224px minmax(0, 1fr); height: 100dvh; }
.side { display: flex; flex-direction: column; min-height: 0; color: var(--side-ink);
  background: var(--side); }
/* Логотип: стрічка для темного тла, без змін пропорцій; вільне поле — одна клітинка (16 px за висоти 16 px) */
.side__brand { display: flex; align-items: center; height: 48px; padding: 16px; border-bottom: 1px solid var(--side-line); flex: none; }
.side__brand:hover { text-decoration: none; }
.side__brand:focus-visible { outline-color: var(--side-focus); outline-offset: -3px; }
.side__logo { height: 16px; width: auto; display: block; }
.side__znak { height: 20px; width: auto; display: none; }
.side__nav { flex: 1; overflow-y: auto; padding: 8px; scrollbar-color: rgba(232,238,248,.2) transparent; }
.side__group { margin-bottom: 12px; }
.side__group-title { padding: 6px 8px 4px; font-size: var(--fs-12); font-weight: 600; color: var(--side-muted); }
.side__link { display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 8px; border-radius: var(--r-6);
  color: var(--side-ink); font-size: var(--fs-13); font-weight: 500; white-space: nowrap; overflow: hidden; }
.side__link span { overflow: hidden; text-overflow: ellipsis; }
.side__link:hover { text-decoration: none; }
.side__link[aria-current="page"] { background: var(--side-active); color: var(--side-ink-strong); font-weight: 600; }
.side__link:focus-visible { outline-color: var(--side-focus); outline-offset: -2px; }
@media (hover: hover) and (pointer: fine) { .side__link:hover:not([aria-current="page"]) { background: var(--side-hover); } }
.side__foot { flex: none; padding: 8px 12px; border-top: 1px solid var(--side-line); font-size: var(--fs-12); color: var(--side-muted); }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.top { display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 12px; background: var(--surface);
  border-bottom: 1px solid var(--line); flex: none; }
.top__menu { display: none; }
.top__ctx { display: flex; align-items: center; gap: 6px; min-width: 0; }
.top__ctx-label { font-size: var(--fs-12); color: var(--ink-muted); white-space: nowrap; }
.ctx-btn { display: inline-flex; align-items: center; gap: 6px; height: var(--ctl); max-width: 280px; padding: 0 8px;
  border: 1px solid var(--line-strong); border-radius: var(--r-6); background: var(--surface-2); font-weight: 600;
  font-size: var(--fs-13); }
.ctx-btn > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-btn--static { border-color: transparent; background: transparent; padding-left: 0; cursor: default; }
.top__site { max-width: 200px; }
.top__spacer { flex: 1; }
.top__search { position: relative; width: min(280px, 26vw); }
.top__search .icon { position: absolute; left: 8px; top: 7px; color: var(--ink-muted); pointer-events: none; }
.top__search .input { padding-left: 28px; }
.top__env { display: flex; gap: 6px; align-items: center; }
.top__count { min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--mark); color: var(--on-mark);
  font-size: 11px; font-weight: 700; line-height: 16px; text-align: center; }
.top__btn { position: relative; }
.top__btn .top__count { position: absolute; top: -4px; right: -4px; }
.top__counters { display: flex; gap: 6px; align-items: center; flex-wrap: nowrap; }
.top__counters[hidden] { display: none; }
.top__counter { height: 24px; text-decoration: none; white-space: nowrap; font-size: var(--fs-12); }
.top__counter:hover { filter: brightness(0.96); }
.top__counter:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.content { flex: 1; min-height: 0; overflow: auto; padding: 0 16px 16px; display: flex; flex-direction: column; }
.content:focus { outline: none; }
.page__head { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 8px 0; flex: none; flex-wrap: wrap; }
.page__title { font-size: var(--fs-16); font-weight: 650; line-height: 1.25; }
.page__sub { font-size: var(--fs-13); color: var(--ink-muted); }
.page__actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.page__body { display: flex; flex-direction: column; gap: 12px; min-height: 0; flex: 1; }

/* Вкладки розділу */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); flex: none; overflow-x: auto; scrollbar-width: none; }
.tab { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border: 0; background: none;
  color: var(--ink-muted); font-weight: 500; font-size: var(--fs-13); border-bottom: 2px solid transparent;
  margin-bottom: -1px; white-space: nowrap; }
.tab:hover { text-decoration: none; color: var(--ink); }
.tab[aria-current="page"], .tab[aria-selected="true"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--accent); }
.tab__n { font-size: var(--fs-12); color: var(--ink-muted); font-weight: 500; }

/* ---------- Фільтри ---------- */
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; flex: none; }
.filters .input, .filters .select { width: auto; min-width: 140px; }
.filters .filters__search { width: 240px; }
.chips { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.chip { height: 26px; padding: 0 10px; border-radius: 13px; border: 1px solid var(--line-strong); background: var(--surface);
  font-size: var(--fs-12); font-weight: 500; color: var(--ink-2); user-select: none; -webkit-user-select: none; }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 50%, transparent);
  color: var(--accent-ink); font-weight: 600; }
.filters__count { margin-left: auto; font-size: var(--fs-12); color: var(--ink-muted); }

/* ---------- Таблиця ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-8); min-width: 0; }
.panel__head { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 4px 8px 4px 12px;
  border-bottom: 1px solid var(--line); }
.panel__title { font-size: var(--fs-13); font-weight: 650; }
.panel__n { font-size: var(--fs-12); color: var(--ink-muted); }
.panel__actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.panel__body { padding: 12px; }
.table-wrap { overflow: auto; min-height: 0; max-height: 100%; border-radius: inherit; }
.panel--fill { flex: 1; min-height: 120px; display: flex; flex-direction: column; overflow: hidden; }
.panel--fill > .table-wrap { flex: 1; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-13); }
.table th { position: sticky; top: 0; z-index: 1; height: 30px; padding: 0 10px; text-align: left; font-size: var(--fs-12);
  font-weight: 600; color: var(--ink-muted); background: var(--surface); border-bottom: 1px solid var(--line-strong);
  white-space: nowrap; }
.table th.num, .table td.num { text-align: right; }
.table td { height: var(--row); padding: 4px 10px; border-bottom: 1px solid var(--line); vertical-align: middle;
  max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table td.wrap { white-space: normal; overflow-wrap: anywhere; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr[tabindex] { cursor: pointer; }
.table tbody tr[tabindex]:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.table tbody tr[aria-selected="true"] td { background: var(--accent-soft); }
@media (hover: hover) and (pointer: fine) { .table tbody tr[tabindex]:hover td { background: var(--surface-2); }
  .table tbody tr[aria-selected="true"]:hover td { background: var(--accent-soft); } }
.th-sort { display: inline-flex; align-items: center; gap: 4px; height: 100%; padding: 0; border: 0; background: none;
  font: inherit; color: inherit; }
.th-sort .icon { opacity: 0; }
th[aria-sort="ascending"] .th-sort, th[aria-sort="descending"] .th-sort { color: var(--ink); }
th[aria-sort="ascending"] .th-sort .icon, th[aria-sort="descending"] .th-sort .icon { opacity: 1; }
th[aria-sort="descending"] .th-sort .icon { transform: rotate(180deg); }
.table__empty td { height: 40px; color: var(--ink-muted); cursor: default; }
.table__sub { color: var(--ink-muted); font-size: var(--fs-12); }
.table tr.is-planned td { color: var(--ink-muted); }
.table tr.is-planned td:first-child { font-style: italic; }
.table tr.is-off td { color: var(--ink-muted); }
.table tr.is-off td:first-child { text-decoration: line-through; text-decoration-color: var(--line-strong); }
.cell-actions { display: inline-flex; gap: 4px; }
.skeleton td { height: var(--row); }
.skeleton span { display: block; height: 10px; border-radius: 5px; background: var(--surface-3); width: 60%; }
.state-line { padding: 10px 12px; color: var(--ink-muted); font-size: var(--fs-13); display: flex; gap: 8px; align-items: center; }

/* ---------- Висувна картка ---------- */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 30; width: min(520px, 100vw); display: flex;
  flex-direction: column; background: var(--surface); border-left: 1px solid var(--line-strong);
  box-shadow: var(--shadow-pop); transform: translateX(100%); visibility: hidden;
  transition: transform 180ms var(--ease-out), visibility 0s linear 180ms; }
.drawer--wide { width: min(760px, 100vw); }
.drawer[data-open="true"] { transform: translateX(0); visibility: visible; transition: transform 180ms var(--ease-out), visibility 0s; }
.drawer__head { display: flex; align-items: flex-start; gap: 8px; padding: 10px 8px 10px 16px; border-bottom: 1px solid var(--line); flex: none; }
.drawer__titles { min-width: 0; flex: 1; }
.drawer__title { font-size: var(--fs-16); font-weight: 650; line-height: 1.3; overflow-wrap: anywhere; }
.drawer__title--name { font-size: var(--fs-18); }
.drawer__sub { font-size: var(--fs-12); color: var(--ink-muted); margin-top: 2px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.drawer__body { flex: 1; overflow-y: auto; padding: 12px 16px 16px; display: flex; flex-direction: column; gap: 16px;
  overscroll-behavior: contain; }
.drawer__foot { flex: none; display: flex; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--line); flex-wrap: wrap;
  padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
.section { display: flex; flex-direction: column; gap: 8px; }
.section__title { font-size: var(--fs-13); font-weight: 650; display: flex; align-items: center; gap: 8px; }
.section__title .btn { margin-left: auto; }

/* Хронологія */
.timeline { display: flex; flex-direction: column; }
.timeline__item { position: relative; padding: 0 0 12px 16px; font-size: var(--fs-13); }
.timeline__item::before { content: ""; position: absolute; left: 3px; top: 6px; width: 7px; height: 7px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--neutral); }
.timeline__item::after { content: ""; position: absolute; left: 6px; top: 16px; bottom: 0; width: 1px; background: var(--line-strong); }
.timeline__item:last-child::after { display: none; }
.timeline__meta { font-size: var(--fs-12); color: var(--ink-muted); }
.diff { display: grid; grid-template-columns: auto minmax(0,1fr); gap: 2px 8px; margin-top: 4px; font-size: var(--fs-12); }
.diff dt { color: var(--ink-muted); }
.diff del { color: var(--ink-muted); text-decoration-color: var(--bad); }
.diff ins { text-decoration: none; font-weight: 600; }

/* ---------- Діалог ---------- */
.dialog { border: 1px solid var(--line-strong); border-radius: var(--r-8); padding: 0; width: min(520px, calc(100vw - 24px));
  max-height: calc(100dvh - 32px); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-pop);
  opacity: 1; transform: scale(1); transition: opacity 160ms var(--ease-out), transform 160ms var(--ease-out); }
.dialog--wide { width: min(720px, calc(100vw - 24px)); }
@starting-style { .dialog[open] { opacity: 0; transform: scale(0.97); } }
.dialog::backdrop { background: var(--scrim); }
.dialog__form { display: flex; flex-direction: column; max-height: calc(100dvh - 34px); }
.dialog__head { padding: 14px 16px 0; }
.dialog__title { font-size: var(--fs-16); font-weight: 650; }
.dialog__body { padding: 12px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; font-size: var(--fs-14); }
.dialog__foot { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 16px 14px; border-top: 1px solid var(--line); }
.ctx-table { border: 1px solid var(--line); border-radius: var(--r-6); padding: 10px 12px; background: var(--surface-2); }

/* ---------- Спливне меню ---------- */
.menu { position: fixed; z-index: 40; min-width: 220px; max-width: 360px; max-height: 60vh; overflow: auto; padding: 4px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-8); box-shadow: var(--shadow-pop); }
.menu__item { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 32px; padding: 4px 8px; border: 0;
  border-radius: var(--r-6); background: none; text-align: left; font-size: var(--fs-13); color: var(--ink); }
.menu__item:hover, .menu__item:focus-visible { background: var(--surface-3); text-decoration: none; }
.menu__item[aria-checked="true"] { font-weight: 600; }
.menu__item small { display: block; color: var(--ink-muted); font-weight: 400; font-size: var(--fs-12); }
.menu__sep { height: 1px; background: var(--line); margin: 4px 0; }
.menu__label { padding: 4px 8px; font-size: var(--fs-12); color: var(--ink-muted); }

/* ---------- Сповіщення-рядок ---------- */
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 60; display: flex; flex-direction: column; gap: 8px;
  width: min(380px, calc(100vw - 32px)); pointer-events: none; padding-bottom: env(safe-area-inset-bottom, 0px); }
.toast { pointer-events: auto; display: flex; align-items: flex-start; gap: 8px; padding: 8px 8px 8px 12px;
  border-radius: var(--r-8); background: var(--ink); color: var(--canvas); font-size: var(--fs-13);
  box-shadow: var(--shadow-pop); opacity: 1; transform: translateY(0);
  transition: opacity 160ms var(--ease-out), transform 160ms var(--ease-out); }
@starting-style { .toast { opacity: 0; transform: translateY(8px); } }
.toast[data-leaving] { opacity: 0; transform: translateY(8px); }
.toast__text { flex: 1; padding: 3px 0; overflow-wrap: anywhere; }
.toast .icon { margin-top: 4px; }
.toast .btn { background: transparent; color: inherit; border-color: color-mix(in srgb, currentColor 35%, transparent); }
.toast--bad .icon:first-child { color: #ff9c9c; }
.toast--ok .icon:first-child { color: #7ee2a4; }
:root[data-theme="dark"] .toast--bad .icon:first-child { color: #b91c1c; }
:root[data-theme="dark"] .toast--ok .icon:first-child { color: #15803d; }

/* ---------- Календар-розклад ---------- */
.cal { display: grid; flex: 1; min-height: 240px; overflow: auto; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-8); position: relative; }
.cal__corner, .cal__res { position: sticky; top: 0; z-index: 3; background: var(--surface); border-bottom: 1px solid var(--line-strong);
  height: 40px; padding: 4px 8px; display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.cal__corner { left: 0; z-index: 4; }
.cal__res { border-left: 1px solid var(--line); }
.cal__res b { font-size: var(--fs-13); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal__res small { font-size: var(--fs-12); color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal__times { position: sticky; left: 0; z-index: 2; background: var(--surface); }
.cal__time { height: var(--cal-hour); font-size: var(--fs-12); color: var(--ink-muted); text-align: right; padding: 0 6px;
  transform: translateY(-8px); }
.cal__time:first-child { visibility: hidden; }
.cal__col { position: relative; border-left: 1px solid var(--line);
  background-image: linear-gradient(to bottom, var(--line) 1px, transparent 1px);
  background-size: 100% var(--cal-hour); background-color: var(--surface-2); }
.cal__shift { position: absolute; left: 0; right: 0; background: var(--surface);
  background-image: linear-gradient(to bottom, var(--line) 1px, transparent 1px); background-size: 100% var(--cal-hour); }
.cal__absence { position: absolute; left: 0; right: 0; z-index: 1; pointer-events: none;
  background: repeating-linear-gradient(135deg, var(--neutral-soft) 0 6px, transparent 6px 12px); }
.cal__absence span { position: sticky; top: 44px; display: inline-block; margin: 2px 4px; padding: 0 4px; font-size: var(--fs-12);
  background: var(--surface); border-radius: 4px; color: var(--ink-muted); }
.cal__slot { position: absolute; left: 0; right: 0; border: 0; background: transparent; padding: 0; z-index: 1; }
.cal__slot:focus-visible { outline-offset: -2px; }
@media (hover: hover) and (pointer: fine) { .cal__slot:hover { background: var(--accent-soft); } }
.cal__ev { position: absolute; left: 3px; right: 3px; z-index: 2; border-radius: 4px; padding: 2px 6px; overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--ev) 45%, transparent); background: color-mix(in srgb, var(--ev) 12%, var(--surface));
  color: var(--ink); font-size: var(--fs-12); line-height: 1.3; text-align: left; display: block; --ev: var(--accent); }
.cal__ev b { font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal__ev span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); }
.cal__ev--ok { --ev: var(--ok); } .cal__ev--warn { --ev: var(--warn); } .cal__ev--neutral { --ev: var(--neutral); }
.cal__ev--pending { border-style: dashed; }
.cal__ev--short { padding-top: 1px; padding-bottom: 0; }
.cal__ev--short span { display: none; }
.cal__ev--off { --ev: var(--neutral); opacity: 0.7; text-decoration: line-through; }
.cal__now { position: absolute; left: 0; right: 0; height: 2px; background: var(--mark); z-index: 2; pointer-events: none; }
.cal-legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: var(--fs-12); color: var(--ink-muted); align-items: center; }
.cal-legend i { display: inline-block; width: 14px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px;
  border: 1px solid var(--line-strong); }

/* Слоти вільного часу */
.slots { display: flex; flex-wrap: wrap; gap: 4px; }
.slot { height: 28px; min-width: 56px; padding: 0 8px; border-radius: var(--r-6); border: 1px solid var(--line-strong);
  background: var(--surface); font-size: var(--fs-13); font-weight: 500; }
.slot[aria-pressed="true"] { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--on-accent); font-weight: 600; }
.slot-day { font-size: var(--fs-12); color: var(--ink-muted); font-weight: 600; margin: 6px 0 2px; }

/* Контроль завершеності */
.checklist { display: flex; flex-direction: column; gap: 4px; }
.checklist li { display: flex; gap: 8px; align-items: flex-start; font-size: var(--fs-13); }
.checklist .icon { margin-top: 2px; }
.checklist .is-ok .icon { color: var(--ok); } .checklist .is-bad .icon { color: var(--bad-ink); } .checklist .is-warn .icon { color: var(--warn); }

/* Стадії справи */
.stages { display: flex; gap: 0; flex-wrap: wrap; counter-reset: st; font-size: var(--fs-12); }
.stage { display: flex; align-items: center; gap: 6px; padding: 4px 10px 4px 8px; border: 1px solid var(--line-strong);
  margin-right: -1px; background: var(--surface); color: var(--ink-muted); }
.stage:first-child { border-radius: var(--r-6) 0 0 var(--r-6); } .stage:last-child { border-radius: 0 var(--r-6) var(--r-6) 0; }
.stage[data-state="done"] { color: var(--ok-ink); } .stage[data-state="current"] { color: var(--ink); font-weight: 650; background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 50%, transparent); z-index: 1; }

/* Попередній перегляд тексту документа */
.doc-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: var(--fs-14); line-height: 1.55; max-width: 72ch;
  padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-6); }
.fingerprint { font-family: var(--mono); font-size: var(--fs-12); overflow-wrap: anywhere; padding: 6px 8px;
  background: var(--surface-3); border-radius: var(--r-6); }

/* ---------- Вхід ---------- */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 16px; background: var(--canvas); }
.auth__box { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-8);
  padding: 20px; display: flex; flex-direction: column; gap: 16px; }
/* Екран входу: блок із дескриптором, від 160 px завширшки; вільне поле — одна клітинка (≈ 50 px разом із полем картки) */
.auth__logo { display: block; width: 168px; height: auto; margin: 30px auto 14px; }
.auth__logo--dark { display: none; }
:root[data-theme="dark"] .auth__logo--light { display: none; }
:root[data-theme="dark"] .auth__logo--dark { display: block; }
.auth__title { font-size: var(--fs-16); font-weight: 650; }
.auth__text { font-size: var(--fs-14); color: var(--ink-2); }
.auth__foot { display: flex; justify-content: space-between; align-items: center; font-size: var(--fs-12); color: var(--ink-muted); gap: 8px; }
.auth .input { height: 38px; }
.auth .btn--primary { height: 38px; }
.secret { font-family: var(--mono); font-size: var(--fs-14); letter-spacing: 0.06em; padding: 8px 10px; background: var(--surface-3);
  border-radius: var(--r-6); overflow-wrap: anywhere; user-select: all; }

/* ---------- Робоче місце: кілька робочих списків ---------- */
.worklists { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; }
.worklists > .panel--span { grid-column: 1 / -1; }
.worklists .table-wrap { max-height: 340px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 12px; min-height: 0; flex: 1; }
.split > * { min-height: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }

/* ---------- Адаптація ---------- */
@media (max-width: 1180px) {
  .shell { grid-template-columns: 52px minmax(0, 1fr); }
  .side__link span, .side__group-title, .side__foot { display: none; }
  .side__brand { justify-content: center; padding: 0; }
  .side__logo { display: none; }
  .side__znak { display: block; }
  .side__link { justify-content: center; padding: 0; }
  .side__group { margin-bottom: 4px; padding-bottom: 4px; border-bottom: 1px solid var(--side-line); }
  .side__nav { padding: 6px; }
  .split { display: flex; flex-direction: column; flex: none; }
  .split > * { overflow: visible !important; flex: none; }
  .top__ctx-label { display: none; }
}
@media (max-width: 860px) {
  .worklists { grid-template-columns: minmax(0, 1fr); }
  .top__search { display: none; }
  .ctx-btn { max-width: 170px; }
  .top__site { display: none; }
}
@media (max-width: 640px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset: 0 auto 0 0; width: 240px; z-index: 50; transform: translateX(-100%); visibility: hidden;
    transition: transform 180ms var(--ease-out), visibility 0s linear 180ms; }
  .side[data-open="true"] { transform: none; visibility: visible; transition: transform 180ms var(--ease-out), visibility 0s; }
  .side__link span, .side__group-title, .side__foot { display: revert; }
  .side__brand { justify-content: flex-start; padding: 16px; }
  .side__logo { display: block; }
  .side__znak { display: none; }
  .side__link { justify-content: flex-start; padding: 0 8px; height: 40px; }
  .top__menu { display: inline-flex; }
  .content { padding: 0 12px 12px; }
  .top__env .badge span { display: none; }
  .top__counter span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .drawer, .drawer[data-open="true"], .side, .side[data-open="true"] { transition: none; }
  .dialog, .toast { transition: opacity 120ms ease; transform: none !important; }
}
.auth .form__status:empty { display: none; }

/* ---------- Прийом: бічна панель підписання, походження, показники ---------- */
.visit-side { display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.visit-side__scroll { display: flex; flex-direction: column; gap: 12px; min-height: 0; overflow: auto; flex: 1; padding-bottom: 8px; }
.visit-sign { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.visit-sign__go { width: 100%; justify-content: center; height: 36px; }
.visit-sign__why { font-size: var(--fs-12); color: var(--ink-muted); margin: 0; }
.visit-mark { display: inline-flex; align-items: center; gap: 6px; margin-left: 8px; font-weight: 400; }
.visit-tpl { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.visit-prev summary { cursor: pointer; padding: 4px 0; }
.visit-prev__copy { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; }
.visit-spark { display: block; color: var(--accent-ink); }
.visit-vit { display: grid; grid-template-columns: minmax(140px, 1fr) auto 120px; gap: 8px; align-items: center; padding: 4px 0; border-bottom: 1px solid var(--line); }
.visit-vit:last-child { border-bottom: 0; }
.visit-crit { border-left: 3px solid var(--bad); padding-left: 8px; }
@media (max-width: 1180px) {
  .visit-side__scroll { overflow: visible; flex: none; }
}
