/* Registry layouts: bounded supporting columns and aligned, readable values. */
#toast:not(.visible) {
  visibility: hidden;
  pointer-events: none;
}

body:has(.registry-stats) {
  height: 100dvh;
  overflow: hidden;
}

.shell:has(.registry-stats) {
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

.main:has(.registry-stats) {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

#content:has(> .registry-stats) {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  padding-bottom: 24px;
}

#content:has(> .registry-stats) > .page-heading,
#content > .registry-stats {
  flex: 0 0 auto;
}

#content:has(> .registry-stats) > .panel,
#content:has(> .registry-stats) #table-area {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

#content:has(> .registry-stats) .registry-toolbar,
#content:has(> .registry-stats) .table-footer {
  flex: 0 0 auto;
}

#content:has(> .registry-stats) .table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

#content:has(> .registry-stats) #table-area > .empty {
  overflow: auto;
}

.registry-table .row-open:focus-visible {
  outline: 2px solid #008967;
  outline-offset: -3px;
}

.registry-table .column-filter-trigger {
  min-width: 0;
  margin: 0;
  padding: 0;
  gap: 4px;
}

.registry-table .column-filter-trigger > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.registry-table .column-filter-trigger i {
  flex: 0 0 12px;
}

@media (min-width: 801px) {
  .registry-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f1f5f3;
    box-shadow: inset 0 -1px #e0e8e3;
  }
}

@media (max-width: 800px) {
  .shell:has(.registry-stats) {
    display: flex;
    flex-direction: column;
  }

  .shell:has(.registry-stats) > .sidebar {
    flex: 0 0 auto;
    padding: 8px 14px;
  }

  .shell:has(.registry-stats) .brand-logo {
    width: 90px;
    height: 34px;
  }

  .main:has(.registry-stats) {
    flex: 1 1 auto;
    height: auto;
  }

  #content:has(> .registry-stats) {
    padding: 10px 12px calc(78px + env(safe-area-inset-bottom));
  }

  #content:has(> .registry-stats) > .page-heading {
    margin-bottom: 10px;
  }

  #content:has(> .registry-stats) .page-heading h1 {
    font-size: 19px;
    line-height: 1.3;
    letter-spacing: -.3px;
  }

  #content:has(> .registry-stats) .page-heading .eyebrow,
  #content:has(> .registry-stats) .page-heading p,
  #content > .registry-stats .stat-icon,
  #content > .registry-stats .stat > small {
    display: none;
  }

  #content > .registry-stats {
    margin-bottom: 10px;
    gap: 8px;
  }

  #content > .registry-stats .stat {
    padding: 9px 11px;
    border-radius: 9px;
  }

  #content > .registry-stats .stat-top {
    font-size: 11px;
    line-height: 1.35;
  }

  #content > .registry-stats .stat > strong {
    margin: 3px 0 0;
    font-size: 22px;
  }

  #content > .registry-stats--purchases {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  #content > .registry-stats .stat--portfolio .registry-money {
    margin: 6px 0 0;
    gap: 3px 12px;
  }

  #content:has(> .registry-stats) .registry-toolbar {
    padding: 10px;
  }

  #content:has(> .registry-stats) .registry-toolbar .toolbar-group {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #content:has(> .registry-stats) .registry-toolbar .search {
    grid-column: 1 / -1;
  }

  #content:has(> .registry-stats) .registry-toolbar .btn {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 8px;
    gap: 5px;
    font-size: 12px;
    white-space: normal;
    line-height: 1.3;
  }

  #content:has(> .registry-stats) .registry-toolbar .btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
  }

  #content:has(> .registry-stats) .table-footer {
    padding: 8px 12px;
  }
}

@media (max-width: 800px) and (max-height: 700px) {
  .shell:has(.registry-stats) > .sidebar {
    padding: 0;
    border: 0;
  }

  .shell:has(.registry-stats) .sidebar > .brand {
    display: none;
  }

  #content > .registry-stats .stat {
    padding: 6px 8px;
  }

  #content > .registry-stats .stat-top {
    font-size: 10px;
    line-height: 1.25;
  }

  #content > .registry-stats .stat > strong {
    font-size: 20px;
  }
}
.stats.registry-stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stats.registry-stats--contracts {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(320px, 1.9fr);
}

.registry-stats .stat {
  display: block;
  min-width: 0;
  padding: 16px 18px;
  border: 1px solid var(--rule, #e3e9e6);
  border-radius: 12px;
}

.registry-stats .stat-top {
  gap: 12px;
  color: #52675d;
  font-size: 13px;
  line-height: 1.4;
}

.registry-stats .stat-icon {
  display: flex;
  flex: 0 0 auto;
  padding: 6px;
  border-radius: 9px;
}

.registry-stats .stat-icon svg {
  width: 18px;
  height: 18px;
}

.stats.registry-stats .stat > strong {
  margin: 8px 0 3px;
  font-size: 28px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -.035em;
  font-variant-numeric: tabular-nums;
}

.registry-stats .stat > small {
  display: block;
  margin-top: 4px;
  color: #687b70;
  font-size: 12px;
  line-height: 1.45;
}

.registry-money {
  display: grid;
  width: 100%;
  min-width: 0;
  gap: 6px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

.registry-money-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 63px;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}

.registry-money-row strong {
  display: block;
  min-width: 0;
  margin: 0;
  color: #254338;
  font-size: 14px;
  line-height: 1.4;
  font-weight: 650;
  text-align: right;
  white-space: normal;
  overflow-wrap: anywhere;
}

.registry-money-row small {
  display: block;
  margin: 0;
  color: #687b70;
  font-size: 10.5px;
  line-height: 1.4;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
}

.registry-money-row.is-secondary strong {
  color: #536b60;
  font-size: 12.5px;
  font-weight: 500;
}

.registry-table--contracts .registry-money-row {
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
}

.registry-table--contracts .registry-money-row strong {
  text-align: left;
}

.registry-stats .stat--portfolio .registry-money {
  align-items: baseline;
  grid-template-columns: minmax(0, max-content) max-content;
  width: fit-content;
  max-width: 100%;
  margin: 10px 0 7px;
  gap: 7px 12px;
}

.registry-stats .stat--portfolio .registry-money-row {
  display: contents;
}

.registry-stats .stat--portfolio .registry-money-row strong {
  margin: 0;
  color: #254338;
  font-size: clamp(18px, 1.9vw, 25px);
  line-height: 1.25;
  letter-spacing: -.025em;
  text-align: left;
}

.registry-stats .stat--portfolio .registry-money-row.is-secondary strong {
  color: #536b60;
  font-size: clamp(16px, 1.45vw, 19px);
  font-weight: 500;
}

.registry-stats .stat--portfolio .registry-money-row small {
  grid-column: 2;
  font-size: 12px;
}

.registry-toolbar {
  gap: 12px 20px;
  padding: 14px 16px;
}

.registry-toolbar .registry-caption {
  flex: 1 1 190px;
  min-width: 0;
}

.registry-toolbar .registry-caption h2 {
  font-size: 18px;
  line-height: 1.4;
  letter-spacing: -.2px;
}

.registry-toolbar .toolbar-group {
  flex: 1 1 660px;
  min-width: 0;
  gap: 8px;
  align-items: center;
}

.registry-toolbar .search {
  flex: 1 1 220px;
  width: auto;
  min-width: 0;
  max-width: 320px;
}

.registry-toolbar .search input {
  width: 100%;
  min-width: 0;
}

.registry-toolbar select {
  flex: 0 1 156px;
  width: auto;
  min-width: 130px;
  max-width: 190px;
}

.registry-toolbar .btn {
  flex-shrink: 0;
}

@media (min-width: 801px) {
  .table-wrap > table.registry-table--contracts,
  .table-wrap > table.registry-table--purchases {
    width: 100%;
    min-width: 1080px;
    table-layout: fixed;
    white-space: normal;
    font-size: 13px;
    line-height: 1.45;
  }

  .registry-table--purchases .registry-col-primary {
    width: auto;
  }

  .registry-table--contracts .registry-col-primary { width: auto; }
  .registry-table--contracts .registry-col-secondary { width: 22%; }
  .registry-table--contracts .registry-col-money { width: 18%; }
  .registry-table--contracts .registry-col-dates { width: 15%; }
  .registry-table--contracts .registry-col-owner { width: 15%; }
  .registry-table--contracts .registry-col-status { width: 128px; }
  .registry-table--purchases .registry-col-secondary { width: 110px; }
  .registry-table--purchases .registry-col-supplier { width: 185px; }
  .registry-table--purchases .registry-col-owner { width: 175px; }
  .registry-table--purchases .registry-col-dates { width: 185px; }
  .registry-table--purchases .registry-col-status { width: 130px; }

  .table-wrap > table.registry-table--contracts th,
  .table-wrap > table.registry-table--purchases th {
    padding: 12px;
    color: #536b60;
    font-size: 10.5px;
    font-weight: 650;
    line-height: 1.45;
    letter-spacing: .025em;
    white-space: normal;
    vertical-align: middle;
  }

  .table-wrap > table.registry-table--contracts td,
  .table-wrap > table.registry-table--purchases td {
    height: auto;
    padding: 16px 12px;
    color: #354c41;
    border-bottom-color: #e8efeb;
    vertical-align: top;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: normal;
  }

  .table-wrap > table.registry-table--contracts th:first-child,
  .table-wrap > table.registry-table--contracts td:first-child,
  .table-wrap > table.registry-table--purchases th:first-child,
  .table-wrap > table.registry-table--purchases td:first-child {
    padding-left: 18px;
  }

  .registry-table--contracts .cell-title,
  .registry-table--purchases .cell-title {
    max-width: 100%;
    margin: 0 0 5px;
    color: #2b4035;
    font-size: 14px;
    font-weight: 650;
    line-height: 1.45;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: normal;
  }

  .registry-table--contracts .cell-sub,
  .registry-table--purchases .cell-sub {
    max-width: none;
    color: #687c70;
    font-size: 12px;
    line-height: 1.5;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .registry-table--purchases .registry-reference {
    margin: 6px 0;
    color: #66756c;
    font-size: 11.5px;
    line-height: 1.5;
    overflow-wrap: anywhere;
  }

  .registry-table--contracts .code {
    display: block;
    margin-bottom: 4px;
    font-size: 11.5px;
    font-weight: 700;
    line-height: 1.4;
  }

  .registry-table--contracts .tag {
    max-width: 100%;
    margin: 0 3px 4px 0;
    padding: 3px 6px;
    font-size: 11px;
    line-height: 1.35;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .registry-table--contracts .person,
  .registry-table--purchases .person {
    align-items: flex-start;
    gap: 7px;
    min-width: 0;
    font-size: 12px;
    line-height: 1.5;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .registry-table--contracts .person > span:not(.avatar),
  .registry-table--purchases .person > span:not(.avatar) {
    min-width: 0;
  }

  .registry-table--contracts .person .avatar,
  .registry-table--purchases .person .avatar {
    flex: 0 0 26px;
    width: 26px;
    height: 26px;
    border-radius: 8px;
    font-size: 10px;
  }

  .registry-table--contracts .badge,
  .registry-table--purchases .badge {
    max-width: 100%;
    padding: 4px 7px;
    font-size: 11px;
    line-height: 1.4;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .registry-table--contracts .progress {
    width: min(82px, 100%);
    margin-top: 8px;
  }

  .registry-table--contracts .contract-period {
    display: grid;
    gap: 3px;
    font-variant-numeric: tabular-nums;
  }

  .registry-table--contracts .contract-period > span {
    color: #687c70;
    font-size: 12px;
  }

  .registry-table--contracts .deadline,
  .registry-table--purchases td:nth-child(2),
  .registry-table--purchases td:nth-child(5) {
    font-variant-numeric: tabular-nums;
  }

  .registry-table--contracts .deadline small {
    margin-top: 4px;
    font-size: 11px;
    line-height: 1.4;
  }

  .registry-table--purchases td:nth-child(2) {
    color: #2b4035;
    font-weight: 600;
  }

  /* Main values share a line height; supporting details follow on a new line. */
  .registry-table--contracts .code,
  .registry-table--contracts .cell-title,
  .registry-table--contracts .registry-money-row strong,
  .registry-table--contracts .contract-period > span,
  .registry-table--contracts .contract-period > .deadline,
  .registry-table--contracts .person {
    line-height: 22px;
  }

  .registry-table--contracts .code,
  .registry-table--contracts .contract-period > span,
  .registry-table--contracts .person {
    font-size: 13px;
  }

  .registry-table--contracts .cell-title {
    margin-bottom: 4px;
  }

  .registry-table--contracts .cell-sub,
  .registry-table--contracts .registry-money-row small,
  .registry-table--contracts .deadline small {
    font-size: 12px;
    line-height: 18px;
  }

  .registry-table--contracts .contract-period {
    gap: 4px;
  }

  .registry-table--contracts .contract-period > span {
    color: #26354e;
  }

  .registry-table--contracts .badge {
    padding-block: 3px;
    line-height: 16px;
  }
}

@media (min-width: 801px) and (max-width: 1400px) {
  .table-wrap > table.registry-table--contracts {
    min-width: 960px;
  }

  .table-wrap > table.registry-table--purchases {
    min-width: 940px;
  }

  .registry-table--purchases .registry-col-secondary { width: 110px; }
  .registry-table--purchases .registry-col-supplier { width: 145px; }
  .registry-table--purchases .registry-col-owner { width: 130px; }
  .registry-table--purchases .registry-col-dates { width: 150px; }
  .registry-table--purchases .registry-col-status { width: 120px; }

  .registry-toolbar .toolbar-group {
    flex-basis: 100%;
    justify-content: flex-start;
  }

  .registry-toolbar .search {
    max-width: none;
  }
}

@media (min-width: 801px) and (max-width: 1100px) {
  .stats.registry-stats--contracts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .registry-stats--contracts .stat--portfolio {
    grid-column: 1 / -1;
  }
}

@media (max-width: 800px) {
  .stats.registry-stats,
  .stats.registry-stats--contracts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .registry-stats .stat {
    padding: 14px;
  }

  .registry-stats .stat-top {
    align-items: flex-start;
    gap: 7px;
    font-size: 12px;
  }

  .registry-stats .stat-icon {
    padding: 5px;
  }

  .registry-stats .stat-icon svg {
    width: 16px;
    height: 16px;
  }

  .registry-stats .stat > small {
    font-size: 11px;
  }

  .registry-stats--contracts .stat--portfolio {
    grid-column: 1 / -1;
  }

  .registry-stats .stat--portfolio .registry-money-row small {
    font-size: 11px;
  }

  .table-wrap > table.registry-table--contracts,
  .table-wrap > table.registry-table--purchases {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    table-layout: auto;
  }

  .registry-table--contracts colgroup,
  .registry-table--purchases colgroup {
    display: none;
  }

  /* The final cell now contains status, so restore the ordinary mobile card cell. */
  .table-wrap > table.registry-table--contracts td:last-child,
  .table-wrap > table.registry-table--purchases td:last-child {
    grid-column: auto;
    margin-top: 0;
  }

  .table-wrap > table.registry-table--contracts td:last-child::before,
  .table-wrap > table.registry-table--purchases td:last-child::before {
    display: block;
    content: attr(data-label);
  }

  .registry-table--purchases .registry-reference {
    margin: 7px 0;
    color: #66756c;
    font-size: 12px;
    line-height: 1.5;
    overflow-wrap: anywhere;
  }

  .registry-toolbar {
    padding: 14px;
  }

  .registry-toolbar .toolbar-group {
    flex-basis: 100%;
    justify-content: flex-start;
  }

  .registry-toolbar .search {
    flex-basis: 100%;
    max-width: none;
  }

  .registry-toolbar select {
    flex: 1 1 130px;
    width: 100%;
    min-width: 0;
    max-width: none;
  }

  .registry-toolbar .btn {
    flex: 0 1 auto;
    max-width: 100%;
  }
}
