/* Email footer and dates - the canon sheet for Settings > Communications' email-profile section and
   its Edit drawer. It lifts as the scoped CSS of the section and drawer components (CMA-02); every
   colour is a --th-* token, literals are sizes and radii only, and the vocabulary mirrors the page's
   own sections (comm-section-head) and the sender identity drawer (comm-identity-*). The footer
   preview is the exception: it copies the Notice base footer's fixed light colours (handoff/notice.mjml),
   because the email surface stays light in both themes; its link colour stands in for the tenant brand
   link the resolver supplies. Lifting note:
   the section head and drawer shapes copy those components' shipped values on purpose, because
   scoped CSS does not cross component boundaries. */

/* ---------- section ---------- */
.comm-profile {
    min-width: 0;
}

.comm-profile-head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 30px 0 14px;
}

.comm-profile-head h2 {
    margin: 0;
    color: var(--th-ink);
    font-family: var(--th-f-serif);
    font-size: var(--th-size-15);
    font-style: italic;
    font-weight: 500;
}

.comm-profile-head > span {
    height: 1px;
    flex: 1;
    background: var(--th-line);
}

.comm-profile-head small {
    color: var(--th-ink-2);
    font-family: var(--th-f-mono);
    font-size: 11px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.comm-profile-edit {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border: 1px solid var(--th-line-2);
    border-radius: 3px;
    background: var(--th-paper-sunk);
    color: var(--th-ink);
    font-family: inherit;
    font-size: var(--th-size-12);
    font-weight: 500;
    cursor: pointer;
}

.comm-profile-edit svg {
    width: 12px;
    height: 12px;
}

.comm-profile-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 360px);
    gap: 22px;
    padding: 16px 18px;
    border: 1px solid var(--th-line);
    border-radius: var(--th-radius-8);
    background: var(--th-paper-sunk);
}

.comm-profile-facts {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    align-content: start;
    gap: 12px 18px;
    margin: 0;
}

.comm-profile-facts dt {
    padding-top: 2px;
    color: var(--th-ink-2);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.comm-profile-facts dd {
    min-width: 0;
    margin: 0;
    color: var(--th-ink);
    font-size: var(--th-size-14);
    line-height: 1.5;
}

.comm-profile-address {
    white-space: pre-line;
}

.comm-profile-url {
    overflow-wrap: anywhere;
    font-family: var(--th-f-mono);
    font-size: var(--th-size-13);
}

.comm-profile-sample {
    display: block;
    color: var(--th-ink-2);
    font-size: var(--th-size-13);
}

.comm-profile-unset {
    color: var(--th-ink-2);
    font-style: italic;
}

.comm-profile-summary {
    min-width: 0;
}

.comm-profile-stamp {
    margin: 14px 0 0;
    color: var(--th-ink-2);
    font-size: var(--th-size-12);
}

.comm-profile-hint {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    grid-column: 1 / -1;
    margin: 0;
    padding: 10px 12px;
    border: 1px solid var(--th-line);
    border-radius: 6px;
    background: var(--th-paper-2);
    color: var(--th-ink-2);
    font-size: var(--th-size-13);
    line-height: 1.5;
}

.comm-profile-hint svg {
    width: 14px;
    height: 14px;
    flex: none;
    margin-top: 3px;
    color: var(--th-ink-3);
}

.comm-profile-viewonly {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 10px 0 0;
    color: var(--th-ink-2);
    font-size: var(--th-size-12);
}

.comm-profile-viewonly svg {
    width: 12px;
    height: 12px;
    color: var(--th-ink-3);
}

.comm-profile-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 22px 18px;
    border: 1px solid var(--th-line);
    border-radius: var(--th-radius-8);
    background: var(--th-paper-sunk);
    color: var(--th-ink-2);
    font-size: var(--th-size-13);
}

.comm-profile-skeleton {
    display: grid;
    flex: 1;
    gap: 9px;
}

.comm-profile-skeleton span {
    display: block;
    height: 10px;
    border-radius: 3px;
    background: var(--th-paper-2);
}

.comm-profile-skeleton span:nth-child(2) { width: 70%; }
.comm-profile-skeleton span:nth-child(3) { width: 45%; }

/* ---------- footer preview: the email surface stays light in both themes ---------- */
.comm-profile-preview {
    min-width: 0;
    margin: 0;
}

.comm-profile-preview figcaption {
    margin-bottom: 7px;
    color: var(--th-ink-2);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.comm-profile-mail {
    padding: 14px 16px 12px;
    border: 1px solid var(--th-line-2);
    border-radius: 6px;
    background: #FFFFFF;
    color: #1B1B1F;
    font-family: var(--th-f-sans);
    font-size: 12px;
    line-height: 1.5;
}

.comm-profile-mail-cols {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 6px 16px;
    padding-top: 12px;
    border-top: 1px solid #E3E3E0;
}

.comm-profile-mail-cols strong {
    display: block;
    font-weight: 600;
}

.comm-profile-mail-address {
    display: block;
    color: #5C5F66;
    white-space: pre-line;
}

.comm-profile-mail-links {
    display: flex;
    gap: 12px;
    color: #1F4E8C;
    font-weight: 500;
    text-decoration: underline;
}

.comm-profile-mail-reason {
    margin: 10px 0 0;
    color: #6B6E75;
}

/* ---------- drawer ---------- */
.comm-profile-layer {
    position: fixed;
    inset: 0;
    z-index: 94;
}

.comm-profile-backdrop {
    background: var(--th-scrim-deep);
}

.comm-profile-drawer {
    width: 490px;
    max-width: calc(100vw - 32px);
    border-left: 1px solid var(--th-line-2);
    background: var(--th-paper-sunk);
    color: var(--th-ink);
}

.comm-profile-drawer-head {
    display: flex;
    align-items: flex-start;
    flex: none;
    gap: 12px;
    padding: 18px 22px 15px;
    border-bottom: 1px solid var(--th-line);
}

.comm-profile-drawer-heading {
    min-width: 0;
    flex: 1;
}

.comm-profile-eyebrow {
    color: var(--th-ink-2);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.comm-profile-drawer-heading h2 {
    margin: 4px 0 0;
    color: var(--th-ink);
    font-family: var(--th-f-serif);
    font-size: var(--th-size-20);
    font-weight: 500;
    line-height: 1.15;
}

.comm-profile-drawer-heading p {
    margin: 4px 0 0;
    color: var(--th-ink-2);
    font-size: var(--th-size-13);
    line-height: 1.5;
}

.comm-profile-close {
    display: grid;
    width: 30px;
    height: 30px;
    flex: none;
    padding: 0;
    place-items: center;
    border: 1px solid var(--th-line);
    border-radius: 4px;
    background: var(--th-paper-sunk);
    color: var(--th-ink-3);
    cursor: pointer;
}

.comm-profile-close svg {
    width: 14px;
    height: 14px;
}

.comm-profile-drawer-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 0;
    flex: 1;
    overflow-y: auto;
    padding: 18px 22px;
}

.comm-profile-field label {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 7px;
    color: var(--th-ink-2);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.comm-profile-field label span {
    color: var(--th-ink-2);
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
}

.comm-profile-input {
    box-sizing: border-box;
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--th-line-2);
    border-radius: 4px;
    outline: none;
    background: var(--th-paper);
    color: var(--th-ink);
    font-family: var(--th-f-sans);
    font-size: var(--th-size-14);
}

.comm-profile-input.is-url {
    font-family: var(--th-f-mono);
    font-size: var(--th-size-13);
}

textarea.comm-profile-input {
    min-height: 84px;
    resize: vertical;
    line-height: 1.5;
}

.comm-profile-input:focus {
    border-color: var(--th-advant);
}

.comm-profile-input[aria-invalid="true"] {
    border-color: var(--th-risk);
}

.comm-profile-input::placeholder {
    color: var(--th-ink-2);
    opacity: 1;
}

.comm-profile-field p {
    margin: 6px 0 0;
    color: var(--th-ink-2);
    font-size: var(--th-size-12);
    line-height: 1.5;
}

.comm-profile-field-sample {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 8px;
    padding: 7px 10px;
    border-radius: 4px;
    background: var(--th-paper-2);
    color: var(--th-ink-2);
    font-size: var(--th-size-12);
}

.comm-profile-field-sample strong {
    color: var(--th-ink);
    font-weight: 600;
}

.comm-profile-field-error {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin-top: 6px;
    color: var(--th-risk-ink);
    font-size: var(--th-size-12);
    line-height: 1.45;
}

.comm-profile-field-error svg {
    width: 12px;
    height: 12px;
    flex: none;
    margin-top: 2px;
}

.comm-profile-count {
    margin-left: auto;
    color: var(--th-ink-2);
    font-family: var(--th-f-mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
}

.comm-profile-count.is-over {
    color: var(--th-risk-ink);
}

.comm-profile-saved-now {
    margin-top: 6px;
    padding: 6px 9px;
    border-left: 3px solid var(--th-warn);
    border-radius: 3px;
    background: var(--th-warn-soft);
    color: var(--th-warn-ink);
    font-size: var(--th-size-12);
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.comm-profile-saved-now strong {
    font-weight: 600;
}

.comm-profile-drawer-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex: none;
    gap: 10px;
    padding: 14px 22px;
    border-top: 1px solid var(--th-line);
}

.comm-profile-cancel,
.comm-profile-submit {
    padding: 7px 14px;
    border: 1px solid var(--th-line-2);
    border-radius: 4px;
    background: var(--th-paper-sunk);
    color: var(--th-ink);
    font-family: inherit;
    font-size: var(--th-size-13);
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
}

.comm-profile-submit {
    border-color: var(--th-advant-deep);
    background: var(--th-advant-deep);
    color: var(--th-advant-fg);
}

.comm-profile-edit:focus-visible,
.comm-profile-close:focus-visible,
.comm-profile-input:focus-visible,
.comm-profile-cancel:focus-visible,
.comm-profile-submit:focus-visible {
    outline: 2px solid var(--th-advant);
    outline-offset: 2px;
}

.comm-profile-close:disabled,
.comm-profile-input:disabled,
.comm-profile-cancel:disabled,
.comm-profile-submit:disabled {
    cursor: wait;
    opacity: 0.65;
}

@media (max-width: 900px) {
    .comm-profile-card {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 560px) {
    .comm-profile-facts {
        grid-template-columns: minmax(0, 1fr);
        gap: 4px;
    }

    .comm-profile-facts dd {
        margin-bottom: 8px;
    }

    .comm-profile-head small {
        display: none;
    }
}
