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

.mail__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1.25rem;
    background: #fff;
    border-bottom: 1px solid #e6e1da;
}

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

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

.mail__refresh {
    padding: 0.55rem 0.95rem;
    border: 1px solid #d9d3cb;
    border-radius: 999px;
    background: #fff;
    color: #1c1c1c;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-decoration: none;
    text-transform: uppercase;
}

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

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

.mail__folders,
.mail__list,
.mail__reader {
    min-height: 0;
    overflow: auto;
    background: #fff;
}

.mail__folders,
.mail__list {
    border-right: 1px solid #e6e1da;
}

.mail-folder {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.72rem 1rem;
    border-left: 3px solid transparent;
    color: #1c1c1c;
    font-size: 0.92rem;
    text-decoration: none;
}

.mail-folder:hover {
    background: #faf8f6;
}

.mail-folder.is-current {
    border-left-color: var(--color-red);
    background: #fff5f4;
    font-weight: 800;
}

.mail-folder.has-unread .mail-folder__name {
    font-weight: 800;
}

.mail-folder__count {
    color: #6d6862;
    font-size: 0.78rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.mail-folder.has-unread .mail-folder__count {
    color: var(--color-red);
}

.mail-folder-group {
    margin-top: 0.85rem;
    padding-top: 0.7rem;
    border-top: 1px solid #e6e1da;
}

.mail-folder-group__label {
    margin: 0;
    padding: 0.15rem 1rem 0.35rem;
    color: var(--color-red);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

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

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

.mail-item__line,
.mail-item__subject {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
}

.mail-item__from,
.mail-item__subject {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mail-item__from {
    flex: 1;
    font-size: 0.92rem;
}

.mail-item__marks {
    display: inline-flex;
    flex: none;
    gap: 0.2rem;
}

.mail-item__mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.15rem;
    height: 1.15rem;
    border-radius: 50%;
    background: var(--color-red);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 800;
    line-height: 1;
}

.mail-item.is-unread .mail-item__from,
.mail-item.is-unread .mail-item__subject {
    font-weight: 800;
}

.mail-item__date {
    flex: none;
    color: #6d6862;
    font-size: 0.75rem;
    font-weight: 700;
}

.mail-item__subject {
    font-size: 0.88rem;
}

.mail-item__preview {
    overflow: hidden;
    color: #6d6862;
    font-size: 0.78rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mail-item__clip {
    width: 0.9rem;
    height: 0.9rem;
    flex: none;
}

.mail__more {
    display: block;
    margin: 0.85rem 1rem 1rem;
    padding: 0.7rem 1rem;
    border: 1px solid #d9d3cb;
    border-radius: 999px;
    background: #fff;
    color: #1c1c1c;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-align: center;
    text-decoration: none;
    text-transform: uppercase;
}

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

.mail__hint,
.mail__empty,
.mail__placeholder {
    margin: 0;
    padding: 1rem;
    color: #6d6862;
    font-size: 0.9rem;
}

.mail__placeholder {
    display: grid;
    grid-column: 1 / -1;
    place-items: center;
    height: 100%;
}

.mail-id {
    min-height: 0;
    overflow: auto;
    padding: 1rem 0.9rem 1.25rem;
    background: #faf8f6;
}

.mail-id__title {
    margin: 0 0 0.75rem;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.mail-id__note,
.mail-id__empty,
.mail-id__hint,
.mail-id__activity {
    margin: 0;
    color: #5c5854;
    font-size: 0.82rem;
    line-height: 1.4;
}

.mail-id__note,
.mail-id__empty {
    margin-bottom: 0.85rem;
}

.mail-id__kicker {
    margin: 0 0 0.45rem;
    color: #6d6862;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.mail-id__card {
    margin-top: 0.85rem;
    padding: 0.8rem 0.85rem 0.9rem;
    border: 1px solid #e6e1da;
    border-radius: 0.75rem;
    background: #fff;
}

.mail-id__card + .mail-id__card {
    margin-top: 0.7rem;
}

.mail-id__kind {
    margin: 0;
    color: var(--color-red);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.mail-id__name {
    margin: 0.15rem 0 0;
    font-size: 1rem;
    line-height: 1.3;
}

.mail-id__name a,
.mail-id__fiche {
    color: #1c1c1c;
    font-weight: 800;
}

.mail-id__name a:hover,
.mail-id__fiche:hover,
.mail-id__docs a:hover {
    color: var(--color-red);
}

.mail-id__code {
    margin: 0.15rem 0 0.55rem;
    color: #6d6862;
    font-size: 0.78rem;
    font-weight: 700;
}

.mail-id__hint {
    margin-bottom: 0.65rem;
}

.mail-id__facts {
    display: grid;
    gap: 0.45rem;
    margin: 0;
}

.mail-id__facts dt {
    color: #6d6862;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.mail-id__facts dd {
    margin: 0.05rem 0 0;
    font-size: 0.84rem;
    overflow-wrap: anywhere;
}

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

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

.mail-id__activity {
    margin-top: 0.75rem;
    font-weight: 700;
}

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

.mail-id__docs a {
    color: #1c1c1c;
    font-size: 0.82rem;
    font-weight: 800;
}

.mail-id__docs span {
    display: block;
    color: #6d6862;
    font-size: 0.75rem;
}

.mail-id__fiche {
    display: inline-block;
    margin-top: 0.75rem;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    text-decoration: none;
    text-transform: uppercase;
}

.mail__error {
    margin: 1rem;
    padding: 0.85rem 1rem;
    border-radius: 0.8rem;
    background: #fff1f0;
    color: #9d120b;
    font-weight: 700;
}

.mail__reader {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 18rem;
    container-type: inline-size;
    overflow: hidden;
}

.mail__message {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    border-right: 1px solid #e6e1da;
}

.mail-read__head {
    padding: 1rem 1.15rem 0.75rem;
    border-bottom: 1px solid #f0ece7;
}

.mail-read__subject {
    margin: 0 0 0.55rem;
    font-size: 1.15rem;
    font-weight: 800;
    line-height: 1.3;
}

.mail-read__meta {
    margin: 0.15rem 0;
    color: #3f3b37;
    font-size: 0.86rem;
}

.mail-read__meta span {
    display: inline-block;
    min-width: 3.2rem;
    color: #6d6862;
    font-weight: 800;
}

.mail-files {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin: 0;
    padding: 0.7rem 1.15rem;
    list-style: none;
    border-bottom: 1px solid #f0ece7;
}

.mail-files li {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0.65rem;
    border: 1px solid #e6e1da;
    border-radius: 999px;
    background: #faf8f6;
    font-size: 0.8rem;
}

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

.mail-files span {
    color: #6d6862;
}

.mail__frame {
    flex: 1;
    width: 100%;
    min-height: 16rem;
    border: 0;
    background: #fff;
}

@media (max-width: 1100px) {
    .mail {
        height: auto;
        min-height: calc(100vh - 5.45rem);
    }

    .mail__workspace {
        grid-template-columns: 1fr;
    }

    .mail__folders,
    .mail__list {
        max-height: 18rem;
        border-right: 0;
        border-bottom: 1px solid #e6e1da;
    }

    .mail__frame {
        min-height: 28rem;
    }
}

@container (max-width: 680px) {
    .mail__reader {
        grid-template-columns: 1fr;
        overflow: auto;
    }

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