.registry-heading {
  margin-bottom: 22px;
}
.registry-overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 12px;
}
.registry-overview > div {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 16px 18px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--panel-radius);
  box-shadow: var(--panel-shadow, 0 2px 8px #22223808);
}
.registry-overview dt {
  grid-row: 2;
  font-size: 13px;
  font-weight: 560;
  color: var(--muted);
}
.registry-metric-icon {
  display: grid;
  flex: 0 0 32px;
  height: 32px;
  place-items: center;
  color: var(--pine);
  background: var(--wash);
  border-radius: var(--radius);
}
.registry-overview dd {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  margin: 0;
  font-size: clamp(18px, 1.8vw, 29px);
  font-weight: 650;
  line-height: 1.12;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.037em;
}
.registry-metric-value {
  min-width: 0;
  overflow-wrap: anywhere;
}
.registry-summary {
  margin-bottom: 22px;
}
.registry-contract-totals {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 12px 18px;
  margin: 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--panel-radius);
}
.registry-contract-totals dt,
.registry-summary-hint {
  color: var(--muted);
  font-size: 12px;
}
.registry-contract-totals dd {
  margin: 3px 0 0;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.registry-summary-hint {
  margin: 8px 0 0;
  line-height: 1.5;
}
.registry-status-set {
  display: grid;
  gap: 7px;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 13px;
}
.registry-status-set label {
  cursor: pointer;
}
.registry-row-debt {
  text-align: end;
  font-variant-numeric: tabular-nums;
}
.registry-row-debt small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}
.registry-row-debt .registry-row-overdue {
  color: #a14621;
}
.registry-panel {
  overflow: visible;
  box-shadow: var(--panel-shadow, 0 2px 8px #22223808);
}
.registry-panel .table-wrap {
  border-radius: 0 0 var(--panel-radius) var(--panel-radius);
}
.registry-heading > .btn,
.registry-more {
  border-radius: 999px;
}
.registry-panel [hidden] {
  display: none;
}
.registry-tools {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(130px, auto) minmax(146px, auto) auto;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
}
.registry-search {
  position: relative;
  width: 100%;
  min-width: 0;
}
.registry-search > svg {
  position: absolute;
  inset-inline-start: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--dim);
  pointer-events: none;
}
.registry-search > input {
  width: 100%;
  min-height: 41px;
  padding: 9px 11px 9px 38px;
  border: 1px solid var(--control-line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
}
.registry-tools > select {
  width: 100%;
  min-width: 0;
  border-radius: 999px;
}
.registry-filter-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.registry-more[aria-expanded='true'] {
  color: var(--pine);
  background: var(--wash);
  border-color: #cdcbfb;
}
.registry-more::after {
  content: '';
  width: 5px;
  height: 5px;
  border: solid currentColor;
  border-width: 0 1.5px 1.5px 0;
  transform: translateY(-1px) rotate(45deg);
  margin-left: 3px;
}
.registry-more[aria-expanded='true']::after {
  transform: translateY(2px) rotate(225deg);
}
.registry-filter-count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  border-radius: 6px;
  background: var(--wash);
  color: var(--pine);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.registry-filter-actions .registry-reset {
  padding-inline: 5px;
}
.registry-selected {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 0 18px 13px;
}
.registry-selected-filter {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  gap: 8px;
  min-height: 31px;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--wash);
  color: var(--pine);
  font-size: 12px;
  text-align: start;
}
.registry-selected-filter:hover {
  border-color: var(--control-line);
}
.registry-selected-filter > :first-child {
  overflow-wrap: anywhere;
}
.registry-selected-filter > :last-child {
  flex: none;
  font-size: 17px;
  line-height: 1;
}
.registry-results-label {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 8px 18px;
  color: var(--muted);
  border-block: 1px solid var(--line);
  font-size: 13px;
}
.registry-results-label strong {
  font-weight: 550;
}
.registry-results-label > span {
  background: var(--wash);
  color: var(--pine);
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  border-radius: 6px;
  padding: 1px 7px;
}
.registry-results-label .registry-export {
  margin-inline-start: auto;
}
.registry-empty-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: var(--panel-radius);
  background: var(--wash);
  color: var(--pine);
}
.registry-footer {
  justify-content: flex-end;
}
.deal-associates summary {
  cursor: pointer;
  color: var(--pine);
  font-size: 14px;
  font-weight: 600;
}
.deal-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  align-items: start;
  gap: 14px;
  padding: 17px 18px 19px;
  border-top: 1px solid var(--line);
  background: #faf9fc;
}
.registry-totals {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0;
  padding: 17px 20px;
  gap: 15px;
  background: #f8f8fb;
  border-block: 1px solid var(--line);
}
.registry-totals dt {
  font-size: 12px;
  color: var(--muted);
}
.registry-totals dd {
  margin: 4px 0 0;
  font-weight: 625;
  font-size: clamp(16px, 1.45vw, 22px);
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.deal-borrower,
.deal-sub {
  display: block;
  overflow-wrap: anywhere;
}
.deal-borrower {
  font-weight: 550;
}
.deal-sub {
  color: var(--muted);
  margin-top: 4px;
  font-size: 12px;
}
.deals-table .money-cell,
.schedule-table td:last-child {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.deals-table .money-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.deals-table td.money-cell {
  font-weight: 650;
}
.deals-table .registry-date {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.deals-table .record-link {
  color: var(--ink);
  font-weight: 650;
}
.deals-table .registry-record-link {
  display: grid;
  grid-template-columns: 31px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
  text-align: start;
}
.deals-table .registry-record-link > :nth-child(2) {
  text-decoration: underline;
  text-decoration-color: #c7c5d6;
  text-underline-offset: 3px;
}
.deals-table .registry-record-link:hover > :nth-child(2) {
  color: var(--pine);
  text-decoration-color: var(--pine);
}
.deals-table .registry-record-link > svg {
  color: var(--muted);
}
.deals-table .registry-history-link {
  gap: 5px;
  color: var(--pine);
  font-size: 12px;
  font-weight: 550;
}
.registry-file-icon {
  height: 31px;
  display: grid;
  place-items: center;
  background: var(--wash);
  color: var(--pine);
  border-radius: var(--radius);
}
.deals-table tbody tr:last-child td {
  border-bottom: 0;
}
.deals-table thead th,
.schedule-table thead th {
  background: #f8f8fb;
}
.deals-table tbody tr:focus-within,
.deals-table tbody tr:hover {
  background: #faf9ff;
}
.tag:is(.draft, .approved, .issued, .declined, .terminated, .opening_reversed) {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
}
.tag:is(.draft, .approved, .issued, .declined, .terminated, .opening_reversed)::before {
  content: '';
  flex: 0 0 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}
.tag:is(.draft, .opening_reversed) {
  background: #fbf4e6;
  color: #805616;
}
.tag.approved {
  background: #edf5ef;
  color: #35614d;
}
.tag.issued {
  background: #efeeff;
  color: #4943a0;
}
.fee-section {
  border: 1px solid var(--line);
  background: #faf9fc;
  padding: 16px;
  border-radius: var(--panel-radius);
}
.fee-overview {
  display: grid;
  gap: 10px;
}
.fee-overview .decision-buttons:empty,
.balance-area:empty {
  display: none;
}
.fee-line {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.fee-line strong,
.cash-balance strong,
.receipt-summary strong {
  font-variant-numeric: tabular-nums;
}
.receipt-summary,
.cash-balance {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--wash);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 14px 16px;
}
.receipt-summary strong,
.cash-balance strong {
  color: var(--pine);
  font-size: 22px;
}
.cash-balance {
  margin: 0 20px 14px;
}
.finance-table th:first-child {
  min-width: 130px;
}
@media (max-width: 720px) {
  .cash-balance {
    margin: 0 12px 12px;
  }
  .finance-table.records th:first-child {
    min-width: 65px;
  }
  .finance-table td {
    overflow-wrap: anywhere;
  }
}
.tag.declined {
  background: #faedf1;
  color: #8b3c56;
}
.tag.terminated {
  background: #eeeef2;
  color: #51535f;
}
.registry-mobile-meta {
  display: none;
}
.deal-decisions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  background: #faf9fc;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 12px 14px;
}
.deal-decisions > strong,
.decision-summary > strong {
  font-size: 14px;
  font-weight: 600;
}
.decision-buttons,
.status-pair,
.change-values {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.decision-summary {
  display: grid;
  justify-items: start;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 7px;
}
.history-events {
  list-style: none;
  padding: 0;
  margin: 0;
}
.history-event {
  padding: 17px 0;
  border-top: 1px solid var(--line);
}
.history-event:first-child {
  padding-top: 0;
  border-top: 0;
}
.history-event header {
  margin-bottom: 8px;
}
.history-event header .hint {
  margin-top: 4px;
}
.history-values > div {
  padding: 7px 0;
  border: 0;
}
.history-values dd {
  min-width: 0;
}
.history-values .change-values {
  max-width: 100%;
  overflow-wrap: anywhere;
}
.change-values strong {
  font-weight: 580;
}
.history-pager {
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
@media (max-width: 720px) {
  .deal-decisions {
    align-items: flex-start;
  }
  .history-values > div {
    grid-template-columns: minmax(75px, 0.7fr) minmax(0, 1.3fr);
  }
}
.deal-body {
  display: grid;
  gap: 22px;
  min-width: 0;
}
.deal-body > :empty,
.deal-grid:empty,
.picker-values:empty {
  display: none;
}
.deal-section {
  display: grid;
  gap: 15px;
  min-width: 0;
}
.deal-section + .deal-section {
  border-top: 1px solid var(--line);
  padding-top: 20px;
}
.deal-grid {
  display: grid;
  align-items: start;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px 18px;
}
.deal-values > div {
  padding: 9px 0;
}
.deal-values > div:last-child {
  border-bottom: 0;
}
.deal-associates {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #faf9fc;
  padding: 12px 15px;
}
.deal-associates .deal-grid {
  margin-top: 14px;
}
.deal-section > .btn {
  justify-self: start;
}
.plan-result {
  display: grid;
  gap: 13px;
  min-width: 0;
}
.rounding {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
}
.rounding p {
  max-width: 63ch;
}
.schedule-table {
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
}
.schedule-table td,
.schedule-table th {
  height: auto;
  padding: 9px 12px;
}
.schedule-table th:last-child,
.schedule-table td:last-child {
  text-align: right;
}
.schedule-table thead th {
  position: sticky;
  top: 0;
}
.schedule-table tfoot {
  font-weight: 650;
  background: #f8f8fb;
}
.payment-snapshot {
  display: grid;
  gap: 14px;
  min-width: 0;
}
.payment-lines {
  min-width: 0;
}
.payment-lines summary {
  width: fit-content;
  padding-block: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}
.payment-lines[open] summary {
  margin-bottom: 6px;
}
.payment-lines td:nth-child(n + 3),
.payment-lines th:nth-child(n + 3) {
  text-align: right;
  white-space: nowrap;
}
#collect-fee .deal-section {
  margin-block: 16px;
}
.picker-results {
  max-height: 235px;
  overflow: auto;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--panel-shadow, 0 2px 8px #22223808);
}
.picker-results[hidden] {
  display: none;
}
.picker-option {
  display: block;
  border: 0;
  border-bottom: 1px solid var(--line);
  width: 100%;
  background: var(--paper);
  text-align: left;
  padding: 8px 10px;
  font-size: 14px;
}
.picker-option:hover,
.picker-option:focus {
  background: var(--wash);
}
.picker-message {
  padding: 10px;
  color: var(--muted);
  font-size: 13px;
}
.picker-pages {
  padding: 5px 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}
.picker-pages .icon-btn {
  min-height: 26px;
  min-width: 27px;
  padding: 3px;
}
.picker-values {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.choice-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  padding: 3px 4px 3px 8px;
  border-radius: 4px;
  background: var(--wash);
  color: var(--pine);
  font-size: 13px;
  overflow-wrap: anywhere;
}
.chip-x {
  border: 0;
  background: transparent;
  color: inherit;
  padding: 1px 5px;
  font-size: 18px;
  line-height: 1;
}
@media (max-width: 720px) {
  .registry-totals {
    grid-template-columns: 1fr 1fr;
    padding: 13px;
    gap: 12px;
  }
  .deal-body {
    gap: 17px;
  }
}
@media (max-width: 980px) {
  .registry-tools {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  }
  .registry-search {
    grid-column: 1 / -1;
  }
  .deals-table .optional {
    display: none;
  }
  .deals-table .registry-record-link {
    grid-template-columns: minmax(0, 1fr);
  }
  .deals-table .registry-record-link > :is(.registry-file-icon, svg) {
    display: none;
  }
  .registry-mobile-meta {
    display: grid;
    gap: 4px;
    justify-items: start;
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
  }
}
@media (max-width: 640px) {
  .registry-heading {
    margin-bottom: 16px;
  }
  .registry-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 16px;
  }
  .registry-contract-totals {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 10px 12px;
  }
  .registry-overview > div {
    gap: 8px;
    padding: 11px 12px 13px;
  }
  .registry-overview dt {
    font-size: 12px;
  }
  .registry-metric-icon {
    flex-basis: 23px;
    height: 23px;
  }
  .registry-metric-icon svg {
    width: 14px;
    height: 14px;
  }
  .registry-overview dd {
    gap: 7px;
  }
  .registry-tools {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 12px;
  }
  .registry-filter-actions {
    grid-column: 1 / -1;
  }
  .registry-selected {
    padding-left: 12px;
    padding-right: 12px;
  }
  .registry-results-label {
    min-height: 36px;
    padding: 6px 12px;
  }
  .deal-filters {
    padding: 12px;
  }
  .deals-table.records :is(th, td) {
    padding: 9px 8px;
  }
  .deals-table.records :is(th, td):first-child {
    width: 34%;
    min-width: 0;
    padding-left: 12px;
  }
  .deals-table.records .money-cell {
    padding-right: 12px;
  }
  .deals-table .registry-history-link {
    min-height: 44px;
  }
  .deals-table th {
    white-space: normal;
  }
  .deals-table .record-link {
    max-width: 100%;
    overflow-wrap: anywhere;
  }
  .deals-table .deal-sub {
    overflow-wrap: break-word;
  }
  .deals-table .tag {
    white-space: normal;
  }
}
@media (max-width: 520px) {
  .deal-grid,
  .deal-filters {
    grid-template-columns: 1fr;
  }
  .deal-grid {
    gap: 12px;
  }
  .deal-section {
    gap: 11px;
  }
}
@media (max-width: 480px) {
  .deals-table.records thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .deals-table.records tbody {
    display: block;
  }
  .deals-table.records tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: 'contract amount' 'borrower borrower';
    gap: 9px 10px;
    align-items: start;
    padding: 12px;
    border-bottom: 1px solid var(--line);
  }
  .deals-table.records tbody tr:has(.registry-row-debt[data-debt-visible='true']) {
    grid-template-areas: 'contract amount' 'borrower borrower' 'debt debt';
  }
  .deals-table.records tbody tr:last-child {
    border-bottom: 0;
  }
  .deals-table.records tr > :is(.registry-contract, .registry-borrower, .money-cell, .registry-row-debt) {
    height: auto;
    width: auto;
    padding: 0;
    border: 0;
  }
  .deals-table .registry-contract {
    grid-area: contract;
  }
  .deals-table .registry-borrower {
    grid-area: borrower;
  }
  .deals-table .registry-row-debt[data-debt-visible='false'] {
    display: none;
  }
  .deals-table .registry-row-debt {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 8px;
    grid-area: debt;
    text-align: start;
  }
  .deals-table .registry-row-debt::before {
    content: 'Остаток';
    color: var(--muted);
    font-size: 12px;
  }
  .deals-table .money-cell {
    grid-area: amount;
    padding-top: 3px;
  }
  .deals-table .registry-mobile-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px 7px;
  }
  .deals-table .tag {
    white-space: nowrap;
  }
}
@media (max-width: 360px) {
  .registry-overview > div {
    padding-inline: 10px;
  }
  .registry-overview dd {
    gap: 6px;
    font-size: 16px;
  }
  .registry-metric-icon {
    flex-basis: 20px;
    height: 20px;
  }
  .registry-tools > select {
    padding-inline: 7px;
    font-size: 12px;
  }
}
.cash-flow-report {
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--line);
}
.cash-flow-report > summary { cursor: pointer; font-weight: 600; }
.cash-flow-period {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.75rem;
  margin-block: 1rem;
}
.person-deals {
  display: grid;
  gap: 12px;
}
.person-deal-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  border-block-start: 1px solid var(--line);
}
.person-deal-list li {
  display: grid;
  gap: 5px;
  padding-block: 10px;
  border-block-end: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.person-deal-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 12px;
}
.person-deal-heading .record-link {
  text-align: start;
}
