/* Модуль «Договоры»: ход договоров, реестр, карточка.
   Кегль, отступы и радиусы — только токенами (docs/ОБЛИК-И-ШКАЛЫ.md). */

.dog .table--wide { overflow-x: auto; }
.dog__card { margin-bottom: var(--s-3); padding: var(--s-4); }
.dog__card > h2 { margin: 0 0 var(--s-1); }
.dog__card > .note { margin: 0 0 var(--s-3); }
.dog__pad { padding: var(--s-2) 0; }
.dog__kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: var(--s-3); margin-bottom: var(--s-3); }
.dog__kpis > .card + .card { margin-top: 0; }
.dog__kpi { padding: var(--s-3) var(--s-4); }
.dog__kpi-l { font-size: var(--t-sm); color: var(--text-dim); }
.dog__kpi-v { font-family: var(--mono); font-size: var(--t-xl); font-weight: 600; font-variant-numeric: tabular-nums; }
.dog__kpi-v.is-late { color: var(--late-fg); }
.dog__kpi-n { font-size: var(--t-sm); color: var(--text-dim); }

.dog__todo { display: flex; align-items: center; gap: var(--s-3); width: 100%; text-align: left; border: 0; border-top: 1px solid var(--border); background: none; padding: var(--s-2) 0; cursor: pointer; font: inherit; color: inherit; }
.dog__todo:first-child { border-top: 0; }
.dog__todo:hover:where([data-hover="mouse"] *) { background: var(--hover); }
.dog__todo-t { flex: 1; font-size: var(--t-sm); }
.dog__todo-t b { font-weight: 500; }
.dog__dot { width: 8px; height: 8px; border-radius: var(--radius-full); flex: none; }
.dog__dot--late { background: var(--late); }
.dog__dot--warn { background: var(--warn); }

/* Шкала */
.dog__tl { position: relative; }
.dog__row { display: grid; grid-template-columns: 220px 1fr; align-items: center; width: 100%; min-height: 46px; border: 0; border-top: 1px solid var(--border); background: none; padding: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.dog__row--head { min-height: 22px; border-top: 0; cursor: default; }
.dog__row:not(.dog__row--head):hover:where([data-hover="mouse"] *) { background: var(--hover); }
.dog__row-l { padding: var(--s-1) var(--s-3) var(--s-1) 0; font-size: var(--t-sm); min-width: 0; }
.dog__row-l b { display: block; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dog__row-l small { color: var(--text-dim); }
.dog__row-r { position: relative; height: 46px; }
.dog__row--head .dog__row-r { height: 20px; }
.dog__mon { position: absolute; top: 2px; font-family: var(--mono); font-size: var(--t-xs); color: var(--text-dim); }
.dog__bar { position: absolute; top: 10px; height: 14px; border-radius: var(--radius-sm); font-size: var(--t-xs); line-height: 14px; padding-left: var(--s-1); overflow: hidden; white-space: nowrap; color: var(--text-dim); }
.dog__bar.is-done { background: color-mix(in srgb, var(--ok) 45%, var(--surface)); }
.dog__bar.is-wait { background: color-mix(in srgb, var(--warn) 45%, var(--surface)); }
.dog__bar.is-work { background: var(--accent-soft); }
.dog__bar.is-plan { background: transparent; box-shadow: inset 0 0 0 1px var(--border-strong); }
.dog__bar.is-late { background: color-mix(in srgb, var(--late) 40%, var(--surface)); }
.dog__sent { position: absolute; top: 4px; transform: translateX(-50%); font-size: var(--t-sm); color: var(--text); }
.dog__sent.is-late { color: var(--late-fg); }
.dog__rub { position: absolute; top: 28px; transform: translateX(-50%); font-family: var(--mono); font-size: var(--t-xs); font-weight: 700; color: var(--text-faint); }
.dog__rub.is-paid { color: var(--ok-fg); }
.dog__rub.is-wait { color: var(--warn-fg); }
.dog__rub.is-late { color: var(--late-fg); }
.dog__today { position: absolute; top: 0; bottom: 0; left: calc(220px + (100% - 220px) * var(--x) / 100); border-left: 1.5px dashed var(--accent); pointer-events: none; }
.dog__today span { position: absolute; bottom: calc(-1 * var(--s-4)); left: calc(-1 * var(--s-5)); font-family: var(--mono); font-size: var(--t-xs); font-weight: 600; color: var(--accent-fg); }

/* Таблицы */
.dog__table { font-size: var(--t-sm); }
/* The register is wider than a phone: it scrolls inside its box, not the whole page (found by demo-obem, audit У-4) */
.dog__table th, .dog__table td { padding: var(--s-2) var(--s-3); vertical-align: top; }
.dog__table td.num, .dog__table th.num { text-align: right; font-family: var(--mono); }
.dog__grp td { background: var(--hover); cursor: pointer; }
.dog__click { cursor: pointer; }
.dog__prog { height: 6px; border-radius: var(--radius-full); background: var(--border); overflow: hidden; min-width: 80px; margin-bottom: var(--s-1); }
.dog__prog i { display: block; height: 100%; background: var(--ok); }
.dog__table .chip { margin: 0 var(--s-1) var(--s-1) 0; }

/* Карточка: поля на месте */
.dog__title { margin: 0 0 var(--s-3); }
.dog__h1 { font-size: var(--t-2xl) !important; font-weight: 600; height: auto !important; padding: var(--s-1) var(--s-2) !important; }
.dog__in {
  width: 100%; min-width: 0; height: 32px; border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent;
  padding: 0 var(--s-2); font: inherit; color: var(--text);
}
.dog__in:hover:where([data-hover="mouse"] *) { border-color: var(--border); }
.dog__in:focus { outline: 0; border-color: var(--accent); background: var(--surface); }
.dog__in.num { text-align: right; font-family: var(--mono); }
select.dog__in { cursor: pointer; }
.dog__area { height: auto; padding: var(--s-1) var(--s-2); resize: vertical; line-height: 1.45; }
.dog__items { color: var(--text-dim); font-size: var(--t-sm); }
.dog__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-2) var(--s-4); }
.dog__f { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dog__f > span:first-child { font-size: var(--t-xs); color: var(--text-dim); padding-left: var(--s-2); }
.dog__f--wide { grid-column: span 2; }
.dog__pair { display: flex; gap: var(--s-1); align-items: center; }
.dog__days { width: 64px; flex: none; }
.dog__size { width: 96px; flex: none; }
.dog__no { width: 80px; }
.dog__events { display: grid; grid-template-columns: repeat(3, minmax(0, 220px)); gap: var(--s-3); }
.dog__edit td { padding: var(--s-1) var(--s-2); }
.dog__edit td:nth-child(2) { min-width: 240px; }
.dog__n { color: var(--text-dim); font-family: var(--mono); padding-top: var(--s-2) !important; }
.dog__chk { display: flex; align-items: center; gap: var(--s-2); font-size: var(--t-sm); margin: 2px 0; cursor: pointer; }
.dog__inv { display: flex; flex-wrap: wrap; gap: var(--s-1); align-items: center; }
.dog__inv .dog__in { width: auto; min-width: 90px; border-color: var(--border); }
.dog__x { border: 0; background: none; color: var(--text-faint); cursor: pointer; font: inherit; font-size: var(--t-md); padding: 0 var(--s-1); border-radius: var(--radius-sm); }
.dog__x:hover:where([data-hover="mouse"] *) { color: var(--late-fg); background: var(--hover); }
.dog__x--in { font-size: var(--t-sm); margin-left: var(--s-1); padding: 0; }
.dog__sum { margin-top: var(--s-3); font-size: var(--t-sm); color: var(--text-dim); }
.dog__del { color: var(--late-fg); }

@media (max-width: 900px) {
  .dog__grid, .dog__events { grid-template-columns: 1fr; }
  .dog__f--wide { grid-column: auto; }
  .dog__row { grid-template-columns: 130px 1fr; }
  .dog__today { left: calc(130px + (100% - 130px) * var(--x) / 100); }
}

/* Из DOCX */
.dog__modal-wide { width: min(1000px, calc(100vw - 2 * var(--s-4))); max-width: none; }
.dog__docx { max-height: 70vh; overflow: auto; }
.dog__docx .dog__card { box-shadow: none; border: 1px solid var(--border); }
.dog__docx-h { font-size: var(--t-base); margin-bottom: var(--s-2); }
.dog__docx-g { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); margin: var(--s-2) 0; font-size: var(--t-sm); }
.dog__warn { color: var(--warn-fg); margin: var(--s-1) 0 0; }
.dog__edit td.dog__lbl { min-width: 180px; }
.dog__edit td:nth-child(2) .dog__in:first-child { font-weight: 500; }

/* Конструктор документов */
.dog__docrow { display: flex; gap: var(--s-2); align-items: center; flex-wrap: wrap; }
/* Contract folder on the disk: four sections in a row, wrapping */
.dog__razdely { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--s-3); }
.dog__razdel-h { display: flex; align-items: center; gap: var(--s-2); font-weight: 500; margin-bottom: var(--s-1); }
.dog__razdel-h .btn { margin-left: auto; }
.dog__files { list-style: none; margin: 0; padding: 0; font-size: var(--t-sm); }
.dog__files li { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 2px 0; }
.dog__tplsel { width: auto; min-width: 260px; border-color: var(--border); }
.dog__preview { width: 100%; height: 70vh; margin-top: var(--s-3); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.dog__fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: var(--s-4); }
.dog__fields h3 { font-size: var(--t-sm); margin: 0 0 var(--s-2); }
.dog__field { display: flex; gap: var(--s-2); align-items: baseline; width: 100%; text-align: left; border: 0; background: none; padding: 2px var(--s-1); border-radius: var(--radius-sm); cursor: copy; font: inherit; color: inherit; }
.dog__field:hover:where([data-hover="mouse"] *) { background: var(--hover); }
.dog__field code { font-family: var(--mono); font-size: var(--t-xs); color: var(--accent-fg); white-space: nowrap; }
.dog__field span { font-size: var(--t-xs); color: var(--text-dim); }

/* Registry toolbar, sorting, totals */
.dog__search-bar { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; margin-bottom: var(--s-3); }
.dog__search { flex: 1 1 260px; max-width: 420px; min-width: 0; }
.dog__reg { padding: 0; overflow: hidden; }
.dog__reg .dog__table th, .dog__reg .dog__table td { padding: var(--s-2) var(--s-4); }
.dog__reg .dog__table td.num { white-space: nowrap; }
.dog__sort button { border: 0; background: none; padding: 0; font: inherit; color: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; }
.dog__sort.is-on { color: var(--text); }
.dog__sort button:focus-visible, .dog__click:focus-visible { outline: 2px solid var(--accent-ring); outline-offset: -2px; }
.dog__table tfoot td { border-top: 1px solid var(--border-strong); border-bottom: 0; color: var(--text-dim); font-weight: 500; background: var(--surface-2); }
.dog__table tfoot td.num { font-family: var(--mono); }
.dog__reg .dog__prog { max-width: 120px; }
.dog__table .dog__c-st { white-space: nowrap; }
.dog__tl-wrap { overflow-x: auto; padding-bottom: var(--s-5); }
.dog__card.empty { padding: var(--s-6) var(--s-5); }
.dog__x { min-width: 28px; min-height: 28px; }

/* Card: editable fields get a faint frame so they read as inputs */
.dog__grid .dog__in, .dog__events .dog__in { border-color: var(--border); background: var(--surface); }
.dog__grid .dog__pair .dog__in.num { width: 96px; flex: none; }
.dog__grid .dog__pair select.dog__in { flex: 1; }
.dog__edit select.dog__in { min-width: 64px; }
.dog__edit td { min-width: 0; }
.dog__edit td:nth-child(3) { min-width: 140px; }
.dog__kpis .dog__kpi-n:empty { display: none; }

@media (max-width: 700px) {
  .dog .table--wide { overflow-x: visible; }
  .dog__reg .dog__cards tr { display: grid; grid-template-columns: 1fr 1fr; column-gap: var(--s-3); }
  .dog__reg .dog__cards td { width: auto; }
  .dog__reg .dog__cards .dog__c-name, .dog__reg .dog__cards .dog__c-st { grid-column: 1 / -1; }
  .dog__reg .dog__cards .dog__c-no { grid-column: 1 / -1; font-size: var(--t-xs); color: var(--text-dim); }
  .dog__reg .dog__cards .dog__c-no::before { content: '№ '; display: inline; }
  .dog__reg .dog__cards td.dog__c-no[data-l]::before { display: inline; font-size: inherit; }
  .dog__h1 { font-size: var(--t-xl) !important; }
  .dog__kpis { grid-template-columns: 1fr 1fr; gap: var(--s-2); }
  .dog__kpi { padding: var(--s-3); }
  .dog__kpi-v { font-size: var(--t-lg); }
  .dog__card { padding: var(--s-3); }
  .dog__search { max-width: none; flex-basis: 100%; }
  .dog__search-bar .seg { max-width: 100%; overflow-x: auto; }
  .dog__tl { min-width: 640px; }
  /* Tables become stacked cards: the caption comes from data-l */
  .dog__cards, .dog__cards tbody, .dog__cards tr, .dog__cards td { display: block; width: 100%; }
  .dog__cards thead, .dog__cards tfoot td:empty { display: none; }
  .dog__cards tr { padding: var(--s-2) var(--s-3); border-bottom: 1px solid var(--border); position: relative; }
  .dog__cards tr:last-child { border-bottom: 0; }
  .dog__cards td, .dog__reg .dog__table td, .dog__edit td { padding: var(--s-1) 0; border: 0; }
  .dog__cards td[data-l]::before { content: attr(data-l); display: block; font-size: var(--t-xs); color: var(--text-dim); }
  .dog__cards td.num { text-align: left; }
  .dog__edit td:nth-child(2), .dog__edit td:nth-child(3), .dog__edit td.dog__lbl { min-width: 0; }
  .dog__cards td.dog__n { display: none; }
  .dog__cards td.dog__c-x { position: absolute; top: var(--s-1); right: var(--s-1); width: auto; }
  .dog__cards tfoot tr { display: flex; flex-wrap: wrap; gap: var(--s-2); }
  .dog__cards tfoot td { display: block; width: auto; background: none; border: 0; padding: 0; }
  .dog__reg .dog__c-no { display: inline; width: auto; }
  .dog__docx-g { grid-template-columns: 1fr; }
}
.dog__edit .dog__pair select.dog__in { width: 76px; flex: none; }
.dog__edit td:nth-child(4) { min-width: 0; }
.dog__edit.dog__pay td:nth-child(2) { min-width: 0; }
.dog__edit.dog__pay td:nth-child(3) { min-width: 150px; }

/* ── Лист договора: поля слева, документ справа (вариант A, docs/contracts-redesign.md) ──
   Макет — docs/makety/contracts-mockup.html, «A · Лист договора → Создание».
   Цвета источников на листе — от токенов: контрагент — акцент, сделка — фиолетовый
   оттенок, вписано здесь — зелёный, считает портал — подчёркивание, бюро — серый. */
.dogl {
  --dogl-k: color-mix(in srgb, var(--accent) 16%, var(--solid));
  --dogl-k-ink: var(--accent-fg);
  --dogl-d: color-mix(in srgb, oklch(.55 .17 300) 16%, var(--solid));
  --dogl-d-ink: oklch(.42 .15 300);
  --dogl-m: color-mix(in srgb, var(--ok) 18%, var(--solid));
  --dogl-m-ink: var(--ok-fg);
  --dogl-b: var(--well);
  --dogl-b-ink: var(--text-dim);
  height: 100%; display: flex; flex-direction: column; min-height: 0;
  padding-bottom: var(--s-4);
}
.dogl__head { display: flex; align-items: center; gap: var(--s-2); min-width: 0; flex-wrap: nowrap; position: relative; }
.dogl__crumbs { display: flex; gap: var(--s-1); font-size: var(--t-sm); color: var(--text-faint); white-space: nowrap; }
.dogl__crumbs a { color: var(--text-dim); text-decoration: none; }
.dogl__title {
  font: 600 var(--t-lg) var(--font); color: var(--text); min-width: 160px; flex: 1 1 auto; max-width: 420px; text-overflow: ellipsis;
  border: 1px solid transparent; border-radius: var(--radius-sm); background: none; padding: var(--s-1) var(--s-2);
}
.dogl__title:hover:not(:disabled) { border-color: var(--line-2); }
.dogl__title:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); background: var(--solid); }
.dogl__title::placeholder { color: var(--text-faint); font-weight: 400; font-style: italic; }
.dogl__head > .chip { flex: none; white-space: nowrap; }
.dogl__acts { display: flex; align-items: center; gap: var(--s-1); flex: none; position: relative; }
.dogl .btn--line { background: none; box-shadow: inset 0 0 0 1px var(--line-2); }
.dogl .chip--acc { background: var(--accent-soft); color: var(--accent-fg); text-decoration: none; }
.dogl__tpl { width: 240px; height: 32px; border-radius: var(--radius-full); flex: 0 1 240px; min-width: 150px; }
.dogl__hint { font-size: var(--t-xs); color: var(--text-faint); }
.dogl__n { font-style: normal; font-size: var(--t-xs); color: var(--text-faint); margin-left: var(--s-1); }
.dogl__tabsrow { display: flex; align-items: center; gap: var(--s-2); margin: var(--s-2) 0 var(--s-3); }
.dogl__phone { display: none; }
.dogl__people { display: flex; align-items: center; gap: var(--s-1); flex: none; }
.dogl__who {
  width: 26px; height: 26px; border-radius: var(--radius-full); display: grid; place-items: center; flex: none;
  font-size: var(--t-2xs); font-weight: 600; color: var(--solid); background: var(--who);
  box-shadow: 0 0 0 2px var(--solid);
}
.dogl__who + .dogl__who { margin-left: calc(-1 * var(--s-2)); }

/* Two halves with their own scroll */
.dogl__ed {
  flex: 1; min-height: 0; display: grid; grid-template-columns: 400px minmax(0, 1fr);
  border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--solid);
}
@media (max-width: 1599px) { .dogl__ed { grid-template-columns: 360px minmax(0, 1fr); } }
.dogl__left { border-right: 1px solid var(--border); background: var(--island); min-height: 0; display: flex; flex-direction: column; }
.dogl__progress { display: flex; align-items: center; gap: var(--s-2); font-size: var(--t-sm); color: var(--text-dim); padding: var(--s-3) var(--s-4) var(--s-2); }
.dogl__progress .dogl__meter { flex: 1; margin: 0; min-width: 40px; }
.dogl__scroll { overflow: auto; min-height: 0; flex: 1; padding: 0 var(--s-4) var(--s-5); }
.dogl__grp { padding: var(--s-3) 0 var(--s-4); border-bottom: 1px solid var(--border); }
.dogl__grp:last-of-type { border-bottom: 0; }
.dogl__grp > h3 { display: flex; align-items: center; gap: var(--s-2); margin: 0 0 var(--s-3); font-size: var(--t-base); font-weight: 600; }
.dogl__grp > h3 .dogl__n {
  margin: 0; width: 20px; height: 20px; border-radius: var(--radius-full); background: var(--well); color: var(--text-dim);
  display: inline-grid; place-items: center; font-weight: 600;
}
.dogl__grp > h3 .dogl__n.is-ok { background: var(--ok-soft); color: var(--ok-fg); }
.dogl__g2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); }
.dogl__fld { display: flex; flex-direction: column; gap: var(--s-05); min-width: 0; }
.dogl__fld--w { grid-column: 1 / -1; }
.dogl__lbl { font-size: var(--t-xs); font-weight: 500; color: var(--text-dim); display: flex; align-items: center; gap: var(--s-1); white-space: nowrap; }
/* A field always looks like a field: frame on white, hint — paler and italic */
.dogl__in {
  height: 34px; width: 100%; min-width: 0; border: 1px solid var(--line-2); background: var(--solid); color: var(--text);
  border-radius: var(--radius-sm); padding: 0 var(--s-2); font: inherit; font-size: var(--t-base); outline: 0;
}
.dogl__in:hover:not(:disabled) { border-color: var(--text-faint); }
.dogl__in:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.dogl__in::placeholder { color: var(--text-faint); font-style: italic; opacity: .8; }
.dogl__in.num { font-variant-numeric: tabular-nums; }
.dogl__in.is-empty { border-style: dashed; border-color: var(--late); }
.dogl__in.is-pointed { border-color: var(--accent); }
.dogl__in.is-other, .dogl__date.is-other, .dogl__title.is-other { box-shadow: 0 0 0 2px var(--who); }
textarea.dogl__in { height: auto; padding: var(--s-2); resize: vertical; line-height: 1.4; }
select.dogl__in { padding-right: var(--s-1); cursor: pointer; }
.dogl__in--xs { height: 28px; font-size: var(--t-sm); padding: 0 var(--s-1); }
.dogl__date { height: 34px; justify-content: flex-start; }
.dogl__date.is-empty { box-shadow: inset 0 0 0 1px var(--late); }
.dogl__pair { display: flex; gap: var(--s-1); min-width: 0; }
.dogl__pair > .dogl__in:first-child { flex: 1; }
.dogl__pair > select.dogl__in { width: auto; flex: none; }
.dogl__src { font-size: var(--t-2xs); font-weight: 500; padding: 0 var(--s-2); border-radius: var(--radius-full); white-space: nowrap; line-height: 18px; }
.dogl__src--k { background: var(--dogl-k); color: var(--dogl-k-ink); }
.dogl__src--d { background: var(--dogl-d); color: var(--dogl-d-ink); }
.dogl__src--m { background: var(--dogl-m); color: var(--dogl-m-ink); }
.dogl__src--c { background: var(--solid); color: var(--text-dim); box-shadow: inset 0 0 0 1px var(--line); }
.dogl__src--b { background: var(--dogl-b); color: var(--dogl-b-ink); }
.dogl__src--empty { background: var(--late-soft); color: var(--late-fg); box-shadow: inset 0 0 0 1px var(--late); }
.dogl__from { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s-2); }
.dogl__deals { display: flex; gap: var(--s-2); align-items: center; width: 100%; }
.dogl__deals select { flex: 1; }
.dogl__req {
  font-size: var(--t-sm); color: var(--text-dim); background: var(--solid); border-radius: var(--radius-sm); margin: 0;
  padding: var(--s-2) var(--s-3); box-shadow: inset 0 0 0 1px var(--line); display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--s-05) var(--s-3);
}
.dogl__req dt { color: var(--text-faint); }
.dogl__req dd { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dogl__req dd.is-miss { color: var(--late-fg); }
.dogl__row { display: flex; align-items: center; gap: var(--s-2); margin-top: var(--s-2); min-width: 0; }
.dogl__rows { display: flex; flex-direction: column; margin-top: var(--s-2); }
.dogl__line {
  display: grid; grid-template-columns: 18px minmax(0, 1fr) 96px 22px; gap: var(--s-1); align-items: center;
  padding: var(--s-2) 0; border-top: 1px solid var(--hair);
}
.dogl__line--pay { grid-template-columns: 18px minmax(0, 1fr) auto 22px; }
.dogl__no { font-size: var(--t-xs); color: var(--text-faint); font-variant-numeric: tabular-nums; }
.dogl__money { text-align: right; font-variant-numeric: tabular-nums; font-size: var(--t-sm); white-space: nowrap; }
.dogl__sub { grid-column: 2 / 4; display: flex; flex-wrap: wrap; gap: var(--s-1); min-width: 0; }
.dogl__sub > select.dogl__in { width: auto; flex: 1 1 140px; min-width: 0; }
.dogl__days { width: 52px !important; flex: none !important; }
.dogl__size { width: 56px !important; flex: none !important; }
.dogl__check { display: flex; align-items: center; gap: var(--s-2); margin-top: var(--s-2); font-size: var(--t-sm); }
.dogl__byuro { margin-top: var(--s-3); }

/* Right: legend, notice, sheet, page strip */
.dogl__right { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.dogl__edtop { display: flex; align-items: center; gap: var(--s-2); padding: var(--s-2) var(--s-4); border-bottom: 1px solid var(--border); background: var(--solid); min-width: 0; }
.dogl__legend { display: flex; align-items: center; gap: var(--s-1); flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; }
.dogl__notice { padding: var(--s-2) var(--s-4); font-size: var(--t-sm); background: var(--warn-soft); color: var(--warn-fg); }
.dogl__sheetrow { display: flex; min-height: 0; flex: 1; }
.dogl__sheet { flex: 1; min-width: 0; overflow: auto; background: var(--well); padding: var(--s-5) var(--s-5) var(--s-7); position: relative; }
.dogl__page {
  /* Paper stays white in both themes, like a printed sheet */
  width: min(760px, 100%); margin: 0 auto var(--s-4); background: #fff; color: #202020; position: relative; overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 8px 24px rgba(0, 0, 0, .06);
  padding: var(--s-7) var(--s-7) var(--s-6); aspect-ratio: 210 / 297;
  font: 400 var(--t-sm) / 1.5 'PT Serif', Georgia, 'Times New Roman', serif;
}
.dogl__page.is-long { aspect-ratio: auto; }
.dogl__page p { margin: 0 0 var(--s-1); hyphens: auto; }
.dogl__page table.таблица { width: 100% !important; max-width: 100%; margin: var(--s-1) 0 var(--s-2); table-layout: fixed; }
.dogl__page table.таблица td, .dogl__page table.таблица th { padding: var(--s-05) var(--s-1); font-size: inherit; text-align: left; font-weight: inherit; overflow-wrap: anywhere; }
.dogl__page table.таблица td > p { margin: 0; }
.dogl__pn { position: absolute; bottom: var(--s-3); left: 0; right: 0; text-align: center; font: var(--t-2xs) var(--font); color: #999; }
.dogl__warn { font-size: var(--t-sm); color: var(--warn-fg); background: var(--warn-soft); border-radius: var(--radius-sm); padding: var(--s-2) var(--s-3); margin: 0 auto var(--s-3); max-width: 760px; }
.dogl__pad { padding: var(--s-4); }
mark.dog-f { background: transparent; color: inherit; border-radius: 3px; padding: 0 1px; cursor: pointer; transition: box-shadow var(--fast); }
/* The paper is white in both themes: marks are mixed with white, not with the theme surface */
.dogl__page mark.dog-f--k { background: color-mix(in srgb, var(--accent) 16%, #fff); }
.dogl__page mark.dog-f--d { background: color-mix(in srgb, oklch(.55 .17 300) 16%, #fff); }
.dogl__page mark.dog-f--m { background: color-mix(in srgb, var(--ok) 18%, #fff); }
.dogl__page mark.dog-f--b { background: #eceef1; }
.dogl__page mark.dog-f--c { box-shadow: inset 0 -1.5px 0 #9aa1aa; }
.dogl__page mark.dog-f.is-empty { background: #fff2f1; box-shadow: inset 0 0 0 1px var(--late); color: var(--late); }
.dogl__page mark.dog-f.is-hl { box-shadow: 0 0 0 2px var(--accent); background: color-mix(in srgb, var(--accent) 24%, #fff); }
.dogl__strip { width: 56px; flex: none; background: var(--sunken, var(--well)); border-left: 1px solid var(--border); padding: var(--s-3) var(--s-2); display: flex; flex-direction: column; gap: var(--s-2); overflow: auto; }
.dogl__strip a {
  display: block; aspect-ratio: 210 / 297; background: #fff; border-radius: 3px; position: relative; flex: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .15); font-size: var(--t-2xs); color: #888; text-align: center; padding-top: 40%; text-decoration: none;
}
.dogl__strip a.is-on { outline: 2px solid var(--accent); }
.dogl__strip a b { position: absolute; top: 3px; right: 3px; width: 7px; height: 7px; border-radius: var(--radius-full); background: var(--late); }

/* Popovers: versions and «•••» */
.dogl__pop {
  position: absolute; z-index: 30; min-width: 340px; max-width: 440px; background: var(--solid); border-radius: var(--radius);
  box-shadow: var(--shadow-md); padding: var(--s-2); display: flex; flex-direction: column; gap: var(--s-05);
}
.dogl__pop-h { font-size: var(--t-xs); color: var(--text-faint); text-transform: uppercase; letter-spacing: .05em; padding: var(--s-1) var(--s-2); }
.dogl__pop-f { margin-top: var(--s-1); align-self: flex-start; }
.dogl__pop .note { margin: var(--s-1) var(--s-2); }
.dogl__ver { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto auto; gap: var(--s-1); align-items: center; padding: var(--s-1) var(--s-2); border-radius: var(--radius-sm); font-size: var(--t-sm); }
.dogl__ver:hover { background: var(--hover); }
.dogl__ver-t { min-width: 0; color: var(--text-dim); }
.dogl__ver-t small { display: block; color: var(--text-faint); }
.dogl__item { text-align: left; border: 0; background: none; font: inherit; font-size: var(--t-base); color: var(--text); padding: var(--s-2); border-radius: var(--radius-sm); cursor: pointer; }
.dogl__item:hover { background: var(--hover); }
.dogl__sign { display: flex; flex-direction: column; gap: var(--s-3); align-items: flex-start; }
.dogl__sign p { margin: 0; }
.dog__builtin { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) 0 0; border-top: 1px solid var(--border); margin-top: var(--s-3); flex-wrap: wrap; }

/* Laptop: labels in the head shrink */
@media (max-width: 1439px) {
  .dogl__wide { display: none; }
  .dogl__tpl { width: 180px; flex-basis: 180px; }
}
/* Phone: fields, and the sheet behind «Посмотреть договор» */
@media (max-width: 760px) {
  .dogl { height: auto; }
  .dogl__head { flex-wrap: wrap; }
  .dogl__title { flex: 1 1 100%; order: -1; font-size: var(--t-md); }
  .dogl__crumbs { display: none; }
  .dogl__acts { flex-wrap: wrap; width: 100%; }
  .dogl__tpl { flex: 1 1 100%; width: 100%; }
  .dogl__phone { display: inline-flex; margin-left: auto; }
  .dogl__ed { grid-template-columns: 1fr; border-radius: var(--radius); }
  .dogl__left { border-right: 0; }
  .dogl__scroll { overflow: visible; }
  .dogl__right { display: none; }
  .dogl.is-sheet .dogl__right { display: flex; }
  .dogl.is-sheet .dogl__left { display: none; }
  .dogl__sheet { padding: var(--s-2); }
  .dogl__page { aspect-ratio: auto; padding: var(--s-4); font-size: var(--t-xs); }
  .dogl__strip { display: none; }
  .dogl__pop { position: fixed; left: var(--s-3) !important; right: var(--s-3) !important; min-width: 0; max-width: none; }
}
/* The «Ход договоров» table is not turned into cards on the phone: it scrolls inside its box, not the
   whole page (found by demo-obem, audit У-4) */
@media (max-width: 700px) {
  .dog .table--wide:has(> .dog__table:not(.dog__cards)) { overflow-x: auto; max-width: 100%; }
}
