/* @ds-v23 (затвор: только токены) — полоса I: платёжный календарь, баланс, счета (20.11.2026).
 * Раскладка и мелкие детали поверх компонентов DS (кнопки, поля, окна, плашки приходят из ui.js и components.css). */

/* ───────── Платёжный календарь ───────── */
html .ds22 .li-cal{padding:var(--space-7) var(--space-7) var(--space-10)}
html .ds22 .li-cal-bar{display:flex;flex-wrap:wrap;align-items:center;gap:var(--space-4);margin-bottom:var(--space-5)}
html .ds22 .li-cal-bar .ds-input{width:auto}
html .ds22 .li-cal-bar__label{font:var(--type-body);color:var(--text-secondary)}
html .ds22 .li-cal-filterbar{margin-bottom:var(--space-5)}
html .ds22 .li-cal-filter{max-width:460px;padding:var(--space-5) var(--space-6);display:flex;flex-direction:column;gap:var(--space-2);background:var(--surface-sunken);border:1px solid var(--border);border-radius:var(--radius-md)}
html .ds22 .li-cal-filter__head{display:flex;flex-wrap:wrap;align-items:center;gap:var(--space-4);margin-bottom:var(--space-3)}
html .ds22 .li-cal-filter__end{margin-left:auto;display:inline-flex;align-items:center;gap:var(--space-2)}
html .ds22 .li-cal-filter__cap{margin-top:var(--space-3);font:var(--type-micro);letter-spacing:var(--type-micro-tracking);color:var(--text-muted)}
html .ds22 .li-cal-filter__empty{font:var(--type-caption);color:var(--text-muted)}
html .ds22 .li-cal-range{display:flex;flex-wrap:wrap;align-items:center;gap:var(--space-4)}
html .ds22 .li-cal-range .ds-input{width:auto;flex:0 1 150px}
html .ds22 .li-cal-opts{display:flex;flex-direction:column;gap:var(--space-4)}
html .ds22 .li-cal-sample{margin-top:var(--space-6)}
html .ds22 .li-cal-sample__cap{margin-bottom:var(--space-3);font:var(--type-body);font-weight:600;color:var(--text-primary)}
html .ds22 .li-cal-sample__cell{width:220px;max-width:100%;border-top:1px solid var(--border);border-left:1px solid var(--border)}
html .ds22 .li-cal-flow{margin-bottom:var(--space-6);padding:var(--space-5) var(--space-6);border:1px solid var(--border);border-radius:var(--radius-md)}
html .ds22 .li-cal-flow__cap{margin-bottom:var(--space-3);font:var(--type-caption);color:var(--text-secondary)}
html .ds22 .li-cal-flow__svg{display:block;width:100%;height:120px}
html .ds22 .li-cal-grid{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));border-top:1px solid var(--border);border-left:1px solid var(--border);border-radius:var(--radius-sm);overflow:hidden}
html .ds22 .li-cal-head{padding:var(--space-5);font:var(--type-micro);letter-spacing:var(--type-micro-tracking);color:var(--text-muted);background:var(--surface-sunken);border-right:1px solid var(--border);border-bottom:1px solid var(--border)}
html .ds22 .li-cal-day{min-height:96px;padding:var(--space-4) var(--space-5);display:flex;flex-direction:column;gap:var(--space-2);border-right:1px solid var(--border);border-bottom:1px solid var(--border);background:transparent}
html .ds22 .li-cal-day--out{background:var(--surface-sunken)}
html .ds22 .li-cal-day--gap{border-left:3px solid var(--negative)}
html .ds22 .li-cal-num{text-align:right;font:var(--type-body);color:var(--text-secondary)}
html .ds22 .li-cal-day--out .li-cal-num{color:var(--text-muted)}
html .ds22 .li-cal-line{font:var(--type-micro);color:var(--text-muted);font-variant-numeric:tabular-nums;white-space:nowrap}
html .ds22 .li-cal-line--pos{color:var(--positive-strong)}
html .ds22 .li-cal-line--neg{color:var(--negative-strong)}
html .ds22 .li-cal-total{padding:var(--space-1) var(--space-3);font:var(--type-caption);font-variant-numeric:tabular-nums;white-space:nowrap;background:var(--surface-muted);border-radius:var(--radius-xs)}
html .ds22 .li-cal-total--pos{border-left:3px solid var(--positive);color:var(--positive-strong)}
html .ds22 .li-cal-total--neg{border-left:3px solid var(--negative);color:var(--negative-strong)}
html .ds22 .li-cal-plan{display:flex;flex-direction:column;gap:var(--space-2);margin-top:var(--space-3);padding-top:var(--space-3);border-top:1px dashed var(--border-strong)}
html .ds22 .li-cal-op{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;cursor:grab;font:var(--type-micro);color:var(--text-secondary)}
html .ds22 .li-cal-note{margin-top:var(--space-3);font:var(--type-caption);color:var(--text-secondary)}
html .ds22 .li-cal .ds-alert{margin-top:var(--space-5)}

/* ───────── Баланс ───────── */
html .ds22 .li-bal{padding:var(--space-7)}
html .ds22 .li-bal-bar{display:flex;flex-wrap:wrap;align-items:center;gap:var(--space-5);margin-bottom:var(--space-5)}
html .ds22 .li-bal-title{font:var(--type-verdict)}
html .ds22 .li-bal-hint{font:var(--type-caption);color:var(--text-secondary)}
html .ds22 .li-bal-sync{margin-left:auto;font:var(--type-caption);color:var(--text-muted)}
html .ds22 .li-bal-sync--bad{color:var(--negative-strong)}
html .ds22 .li-bal-muted{margin:var(--space-3) 0;font:var(--type-caption);color:var(--text-secondary);line-height:1.5}
html .ds22 .li-bal-note{font:var(--type-micro);font-weight:400;color:var(--text-muted)}
html .ds22 .li-bal-kpis{display:flex;flex-wrap:wrap;gap:var(--space-5);margin-bottom:var(--space-6)}
html .ds22 .li-bal-kpis > .ds-card{flex:1 1 260px;min-width:240px}
html .ds22 .li-bal-kpi{padding:var(--space-5) var(--space-6)}
html .ds22 .li-bal-kpi__v{margin-bottom:var(--space-3);font:var(--type-page-title);font-variant-numeric:tabular-nums}
html .ds22 .li-bal-kpi__name{margin-bottom:var(--space-2);font:var(--type-verdict);font-weight:700}
html .ds22 .li-bal-kpi__hint{margin-bottom:var(--space-4);font:var(--type-caption);color:var(--text-muted);line-height:1.5}
html .ds22 .li-bal-kpi__formula{margin-top:var(--space-4);font:var(--type-caption);color:var(--text-secondary);line-height:1.6}
html .ds22 .li-bal-wrap{overflow:auto;max-height:calc(100vh - 190px);border:1px solid var(--border);border-radius:var(--radius-xs)}
html .ds22 .li-bal-table{border-collapse:collapse;min-width:100%;font:var(--type-caption)}
html .ds22 .li-bal-th{position:sticky;top:0;z-index:2;padding:var(--space-3) var(--space-4);background:var(--surface-sunken)}
html .ds22 .li-bal-th--name{left:0;z-index:3;text-align:left;text-transform:uppercase}
html .ds22 .li-bal-th--num{text-align:right;white-space:nowrap}
html .ds22 .li-bal-name{position:sticky;left:0;padding:var(--space-3) var(--space-4);padding-left:calc(var(--space-5) + var(--lvl,0) * var(--space-6));white-space:nowrap;background:var(--surface)}
html .ds22 .li-bal-name--group{cursor:pointer}
html .ds22 .li-bal-name--diff{padding-left:var(--space-5);font-weight:600}
html .ds22 .li-bal-total .li-bal-name,html .ds22 .li-bal-total{background:var(--surface-sunken);font-weight:600}
html .ds22 .li-bal-diff{border-top:2px solid var(--border-strong)}
html .ds22 .li-bal-num{padding:var(--space-3) var(--space-4);text-align:right;white-space:nowrap;font-variant-numeric:tabular-nums}
html .ds22 .li-bal-num--neg{color:var(--negative)}
html .ds22 .li-bal-num--bad{color:var(--negative);font-weight:600}
html .ds22 .li-bal-num--muted{color:var(--text-muted)}
html .ds22 .li-bal-drill{display:inline-flex;align-items:center;min-height:var(--target-min);padding:0;border:0;background:transparent;font:inherit;color:inherit;cursor:pointer;text-decoration:underline dotted}
html .ds22 .li-bal-drill:focus-visible{outline:2px solid var(--focus-ring);outline-offset:2px}
html .ds22 .li-bal-entries .ds-modal{width:min(820px,calc(100vw - var(--space-9)));max-height:86vh;overflow:auto}
html .ds22 .li-bal-entry{display:flex;flex-wrap:wrap;align-items:flex-start;gap:var(--space-4);padding:var(--space-4) 0;border-top:1px solid var(--border)}
html .ds22 .li-bal-entry__name{flex:0 0 180px;width:180px}
html .ds22 .li-bal-multi{flex:1 1 150px;min-width:150px;height:auto}
html .ds22 .li-bal-emptycol{flex:1 1 150px}
html .ds22 .li-bal-add{margin:var(--space-4) 0}

/* ───────── Счета: печатная форма (бумага — белая с тёмным текстом в любой теме, цвета бумаги заданы в разметке) ───────── */
html .ds22 .li-inv-back{position:fixed;inset:0;z-index:50;display:flex;align-items:center;justify-content:center;background:var(--scrim)}
html .ds22 .li-inv-paper{width:min(820px,94vw);max-height:92vh;overflow:auto;padding:var(--space-8);border-radius:var(--radius-md)}
html .ds22 .li-inv-acts{display:flex;gap:var(--space-4);margin-top:var(--space-8)}
html .ds22 .li-inv-head{padding-bottom:var(--space-4);border-bottom:2px solid currentColor;font:var(--type-caption);line-height:1.5}
html .ds22 .li-inv-title{margin:var(--space-6) 0 var(--space-2);font:var(--type-section-title)}
html .ds22 .li-inv-buyer{margin-bottom:var(--space-6);font:var(--type-caption)}
html .ds22 .li-inv-table{width:100%;border-collapse:collapse;font:var(--type-caption)}
html .ds22 .li-inv-table th,html .ds22 .li-inv-table td{padding:var(--space-2) var(--space-3);border:1px solid currentColor}
html .ds22 .li-inv-c{text-align:center}
html .ds22 .li-inv-r{text-align:right}
html .ds22 .li-inv-totals{margin-top:var(--space-4);text-align:right;font:var(--type-body)}
html .ds22 .li-inv-due{margin-top:var(--space-2);font:var(--type-subsection)}
html .ds22 .li-inv-sign{display:flex;align-items:flex-end;gap:var(--space-9);margin-top:var(--space-10);font:var(--type-caption)}
html .ds22 .li-inv-sign__col{flex:1}
html .ds22 .li-inv-sign__line{position:relative;height:60px;margin:var(--space-3) 0 var(--space-2);border-bottom:1px solid currentColor}
html .ds22 .li-inv-logo{max-height:70px;margin-bottom:var(--space-5)}
html .ds22 .li-inv-sig{position:absolute;left:var(--space-3);bottom:var(--space-1);max-height:56px}
html .ds22 .li-inv-stamp{position:absolute;left:120px;bottom:-14px;max-height:96px;opacity:.9}
