.comm-page {
    padding-block-end: 4rem;
}

.comm-page > .tabs {
    margin-block: 1.5rem;
}

.comm-panel {
    padding: clamp(1.25rem, 3vw, 2.25rem);
}

.comm-panel h2 {
    margin: 0;
}

.comm-section-head {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 1rem;
    margin-block-end: 1.4rem;
}

.comm-section-head p {
    margin-block: .35rem 0;
}

.comm-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto;
    align-items: end;
    gap: .85rem;
    padding: 1rem;
    border: 1px solid var(--line, #dce6da);
    border-radius: 12px;
    background: var(--paper, #f7f8f2);
}

.comm-compose {
    display: grid;
    gap: 1.1rem;
    margin-block-start: 1.3rem;
}

.comm-recipients,
.comm-fields {
    min-width: 0;
    margin: 0;
    padding: 1rem;
    border: 1px solid var(--line, #dce6da);
    border-radius: 12px;
}

.comm-page legend {
    padding-inline: .2rem;
    font-size: var(--subsection-heading-size);
    font-weight: 650;
}

.comm-fields > .field,
.comm-fields > .form-grid + p {
    margin-block-start: 1rem;
}

.comm-fields > p {
    margin: 0 0 .9rem;
    font-size: .9rem;
}

.comm-page .field textarea {
    min-width: 0;
    resize: vertical;
}

.comm-recipient-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .55rem;
    max-height: 17rem;
    overflow-y: auto;
    padding: .25rem;
}

.comm-recipient,
.comm-select-all {
    display: flex;
    align-items: start;
    gap: .6rem;
    cursor: pointer;
}

.comm-select-all[hidden],
[data-comm-letter-field][hidden] {
    display: none;
}

.comm-select-all {
    padding: .35rem;
    font-size: .875rem;
    font-weight: 600;
}

.comm-recipient {
    padding: .5rem .6rem;
    border: 1px solid var(--line, #dce6da);
    border-radius: 9px;
    font-size: .875rem;
}

.comm-recipient:has(input:checked) {
    border-color: var(--green, #185a36);
    background: #eef6e9;
}

.comm-recipient input,
.comm-select-all input {
    accent-color: var(--green, #185a36);
    flex: none;
    width: 1rem;
    height: 1rem;
    margin: .2rem 0 0;
}

.comm-recipient small,
.comm-table small {
    display: block;
    overflow-wrap: anywhere;
    color: var(--muted, #536759);
    font-size: .81rem;
}

.comm-guide {
    font-size: .875rem;
}

.comm-guide summary,
.comm-letter-preview summary {
    color: var(--green-dark, #123e29);
    font-weight: 650;
    cursor: pointer;
}

.comm-token-list {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin-block-start: .5rem;
}

.comm-token-list code {
    padding: .18rem .35rem;
    border-radius: 4px;
    background: #edf3ea;
    overflow-wrap: anywhere;
}

.comm-preview-list {
    display: grid;
    gap: .65rem;
}

.comm-preview-item {
    overflow: hidden;
    border: 1px solid var(--line, #dce6da);
    border-radius: 11px;
}

.comm-preview-item > summary {
    cursor: pointer;
    padding: .7rem 1rem;
    background: var(--paper, #f7f8f2);
}

.comm-preview-item > summary span {
    margin-inline-start: .6rem;
    color: var(--muted, #536759);
    font-size: .86rem;
}

.comm-preview-content {
    display: grid;
    gap: 1rem;
    justify-items: start;
    min-width: 0;
    padding: 1rem;
    overflow-wrap: anywhere;
}

.comm-message-header {
    width: 100%;
    margin: 0;
    padding-block-end: .7rem;
    border-bottom: 1px solid var(--line, #dce6da);
    font-size: .875rem;
}

.comm-message-header > div {
    display: grid;
    grid-template-columns: 4rem minmax(0, 1fr);
    gap: .4rem;
    margin-block: .2rem;
}

.comm-message-header dt {
    color: var(--muted, #536759);
    font-weight: 650;
}

.comm-message-header dd {
    margin: 0;
}

.comm-message-body,
.offer-letter {
    overflow-wrap: anywhere;
}

.comm-letter-preview,
.offer-letter {
    width: 100%;
    max-width: 48rem;
}

.offer-letter {
    margin-block: .75rem;
    padding: clamp(.9rem, 3vw, 1.8rem);
    border: 1px solid var(--line, #dce6da);
    border-top: 5px solid var(--green, #185a36);
}

.offer-letter-head {
    padding-block-end: 1rem;
    border-bottom: 1px solid var(--line, #dce6da);
}

.offer-letter-head strong,
.offer-letter h2,
.offer-letter h3 {
    color: var(--green-dark, #123e29);
}

.offer-letter-head strong {
    font-size: 1.2rem;
}

.offer-letter h3 {
    margin: 1.25rem 0 .35rem;
}

.offer-letter table {
    width: 100%;
    border-collapse: collapse;
}

.offer-letter th,
.offer-letter td {
    min-width: 0;
    padding: .45rem .25rem;
    border-bottom: 1px solid var(--line, #dce6da);
    text-align: left;
}

.offer-letter th {
    width: 36%;
}

.comm-confirm,
.comm-processing {
    padding-block-start: 1rem;
}

.comm-confirm p,
.comm-processing p {
    font-size: .875rem;
    margin-block: .55rem;
}

.comm-template-grid {
    display: grid;
    grid-template-columns: minmax(13rem, .32fr) minmax(0, 1fr);
    align-items: start;
    gap: 1.1rem;
}

.comm-template-menu {
    display: grid;
    gap: .5rem;
}

.comm-template-menu a:not(.btn) {
    padding: .5rem .65rem;
    border-radius: 7px;
}

.comm-template-menu a[aria-current="page"] {
    background: #edf3ea;
    font-weight: 650;
}

.comm-template-menu .btn {
    margin-block-start: .5rem;
    justify-self: start;
}

.comm-table {
    min-width: 34rem;
    margin-block-start: 1rem;
}

.comm-table td:nth-child(2) {
    overflow-wrap: anywhere;
}

@media (max-width: 720px) {
    .comm-toolbar,
    .comm-template-grid,
    .comm-recipient-list {
        grid-template-columns: minmax(0, 1fr);
    }

    .comm-section-head {
        flex-direction: column;
    }

    .comm-preview-item > summary span {
        display: block;
        margin-inline-start: 0;
    }
}
