.commerce {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: calc(100vh - 5.45rem);
    background: #f6f4f1;
    color: #1c1c1c;
}

.commerce__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
    padding: 1rem 1.75rem;
    background: #fff;
    border-bottom: 1px solid #e6e1da;
}

.directory-head .commerce__filters,
.activity-head .commerce__filters {
    display: grid;
    flex: 1;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.65rem;
    margin: 0;
}

.directory-head .commerce__filters {
    grid-template-columns: minmax(11rem, 1fr) minmax(11rem, 1fr) auto auto;
    min-width: min(100%, 36rem);
}

.activity-head .commerce__filters {
    grid-template-columns: repeat(6, minmax(7.5rem, 1fr)) auto;
    min-width: min(100%, 62rem);
}

.directory-head .commerce__search,
.directory-head .commerce__select,
.directory-head .commerce__check,
.directory-head .commerce__submit,
.activity-head .commerce__search,
.activity-head .commerce__select,
.activity-head .commerce__submit {
    height: 2.55rem;
    box-sizing: border-box;
}

.directory-head .commerce__search,
.directory-head .commerce__select,
.activity-head .commerce__search,
.activity-head .commerce__select {
    width: 100%;
    min-width: 0;
    padding: 0 0.95rem;
}

.directory-head .commerce__check {
    padding: 0 0.95rem;
    border: 1px solid #d9d3cb;
    border-radius: 999px;
    background: #fff;
    white-space: nowrap;
}

.directory-head .commerce__submit,
.activity-head .commerce__submit {
    padding: 0 1.15rem;
    white-space: nowrap;
}

.commerce__title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.commerce__meta,
.commerce__hint {
    margin: 0.15rem 0 0;
    color: #5c5854;
    font-size: 0.85rem;
    font-weight: 600;
}

.commerce__filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
    margin-left: auto;
}

.commerce__search,
.commerce__select {
    padding: 0.55rem 0.75rem;
    border: 1px solid #d9d3cb;
    border-radius: 999px;
    background: #fff;
    color: #1c1c1c;
    font: inherit;
    font-size: 0.82rem;
}

.commerce__search {
    width: min(22rem, 100%);
}

.commerce__search:focus,
.commerce__select:focus {
    outline: 2px solid var(--color-red);
    outline-offset: 2px;
}

.commerce__check {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: #3f3b37;
    font-size: 0.82rem;
    font-weight: 700;
}

.commerce__submit {
    padding: 0.55rem 0.95rem;
    border: 0;
    border-radius: 999px;
    background: var(--color-black);
    color: var(--color-white);
    font: inherit;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    cursor: pointer;
}

.commerce__submit:hover {
    background: var(--color-red);
}

.summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.1rem;
    align-items: center;
    margin: 0;
    padding: 0.7rem 1.75rem;
    background: #fff;
    border-bottom: 1px solid #e6e1da;
}

.summary p {
    margin: 0;
    font-size: 0.86rem;
}

.commerce__workspace {
    display: grid;
    grid-template-columns: minmax(18rem, 28rem) minmax(0, 1fr);
    flex: 1;
    min-height: 0;
}

.commerce__list,
.commerce__sheet {
    min-height: 0;
    overflow: auto;
    background: #fff;
}

.commerce__list {
    border-right: 1px solid #e6e1da;
}

.commerce-item {
    display: grid;
    gap: 0.15rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f0ece7;
    color: inherit;
    text-decoration: none;
}

.commerce-item:hover,
.commerce-item.is-current {
    background: #fff5f4;
}

.commerce-item.is-current {
    border-left: 3px solid var(--color-red);
}

.commerce-item__line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    min-width: 0;
}

.commerce-item__title,
.commerce-item__sub {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.commerce-item__title {
    font-size: 0.92rem;
    font-weight: 800;
}

.commerce-item__code,
.commerce-item time,
.commerce-item__amount {
    flex: none;
    color: #6d6862;
    font-size: 0.75rem;
    font-weight: 700;
}

.commerce-item__amount {
    color: #1c1c1c;
}

.commerce-item__sub {
    color: #6d6862;
    font-size: 0.78rem;
}

.commerce__pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.8rem 1.75rem 1.1rem;
    color: #6d6862;
    font-size: 0.82rem;
    font-weight: 800;
}

.commerce__pager a {
    color: #1c1c1c;
    text-decoration: none;
}

.commerce__pager a:hover {
    color: var(--color-red);
}

.commerce__back {
    display: inline-block;
    margin-bottom: 0.35rem;
    color: #6d6862;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-decoration: none;
    text-transform: uppercase;
}

.commerce__back:hover {
    color: var(--color-red);
}

.commerce__back::before {
    content: "← ";
}

.directory-wrap {
    min-width: 0;
    max-width: 100%;
    overflow: auto;
    background: #fff;
    border-bottom: 1px solid #e6e1da;
}

.directory-table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    font-size: 0.86rem;
}

.directory-table th,
.directory-table td {
    padding: 0.7rem 0.85rem;
    border-bottom: 1px solid #f0ece7;
    text-align: left;
    vertical-align: middle;
    white-space: nowrap;
}

.directory-table th:first-child,
.directory-table td:first-child {
    padding-left: 1.75rem;
}

.directory-table th:last-child,
.directory-table td:last-child {
    padding-right: 1.75rem;
}

.directory-table th {
    position: sticky;
    top: 0;
    background: #fbfaf8;
    color: #5c5854;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.directory-table th a {
    color: inherit;
    text-decoration: none;
}

.directory-table th a:hover,
.directory-table th[aria-sort="ascending"] a,
.directory-table th[aria-sort="descending"] a {
    color: var(--color-red);
}

.directory-table__row {
    cursor: pointer;
}

.directory-table__row:hover td {
    background: #fff1ef;
}

.directory-table td:nth-child(n + 3) {
    max-width: 16rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

.directory-table__name {
    color: inherit;
    font-weight: 800;
    text-decoration: none;
}

.directory-table__row:hover .directory-table__name {
    color: var(--color-red);
}

.directory-table .tag {
    margin-left: 0.4rem;
}

.party {
    display: block;
    flex: 1;
    min-width: 0;
    background: #fff;
}

.party__documents {
    min-width: 0;
}

.party .sheet {
    border-bottom: 1px solid #e6e1da;
}

.party .sheet > div {
    padding-left: 1.75rem;
    padding-right: 1.75rem;
}

.party__documents-head {
    padding: 0.9rem 1.75rem 0.2rem;
}

.party__documents-head h2 {
    margin: 0;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.party__documents-head p {
    margin: 0.3rem 0 0.6rem;
    color: #5c5854;
    font-size: 0.86rem;
    font-weight: 700;
}

.commerce__empty,
.commerce__placeholder {
    margin: 0;
    padding: 1rem 1.25rem;
    color: #6d6862;
}

.commerce__placeholder {
    display: grid;
    place-items: center;
    min-height: 16rem;
}

.sheet__head {
    padding: 1rem 1.15rem 0.85rem;
    border-bottom: 1px solid #f0ece7;
}

.sheet__title {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 800;
    line-height: 1.3;
}

.sheet__kicker,
.sheet__code {
    margin: 0.4rem 0 0;
    color: #5c5854;
    font-size: 0.86rem;
    font-weight: 700;
}

.sheet__code {
    display: block;
    margin-top: 0.2rem;
}

.sheet {
    margin: 0;
}

.sheet > div {
    display: grid;
    grid-template-columns: 9.5rem minmax(0, 1fr);
    gap: 0.75rem;
    padding: 0.7rem 1.15rem;
    border-bottom: 1px solid #f0ece7;
}

.sheet dt {
    color: #6d6862;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.sheet dd {
    margin: 0;
    font-size: 0.92rem;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.sheet a {
    color: #1c1c1c;
    font-weight: 800;
}

.sheet a:hover {
    color: var(--color-red);
}

.sheet__related {
    padding: 0.9rem 1.15rem 1.2rem;
}

.sheet__related h3 {
    margin: 0 0 0.35rem;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.sheet__related p {
    margin: 0 0 0.7rem;
}

.sheet__links {
    display: grid;
    gap: 0.4rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.sheet__links a {
    display: grid;
    gap: 0.1rem;
    padding: 0.55rem 0.7rem;
    border: 1px solid #e6e1da;
    border-radius: 0.8rem;
    color: #1c1c1c;
    text-decoration: none;
}

.sheet__links a:hover {
    border-color: var(--color-red);
}

.sheet__links span:first-child {
    font-size: 0.82rem;
    font-weight: 800;
}

.sheet__links span:last-child {
    color: #6d6862;
    font-size: 0.78rem;
}

.tag {
    display: inline-flex;
    align-items: center;
    padding: 0.12rem 0.45rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.tag--livre {
    background: #e7f6ee;
    color: #0d6b3a;
}

.tag--en_cours {
    background: #fff4d6;
    color: #8a5a00;
}

.tag--annule,
.tag--autre {
    background: #f3f1ef;
    color: #5c5854;
}

.tag--avoir,
.tag--missing {
    background: #fff1f0;
    color: #9d120b;
}

@media (max-width: 1100px) {
    .commerce__workspace {
        grid-template-columns: 1fr;
    }

    .commerce__list {
        max-height: 24rem;
        border-right: 0;
        border-bottom: 1px solid #e6e1da;
    }

    .sheet > div {
        grid-template-columns: 1fr;
        gap: 0.2rem;
    }

    .directory-head .commerce__filters,
    .activity-head .commerce__filters {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }
}
