.cx-page {
    box-sizing: border-box;
    width: 100%;
    max-width: var(--cx-content-max-width);
    margin-inline: auto;
    padding: var(--cx-space-4);
}

.cx-page--full-width {
    max-width: none;
}

/* Compact context line (breadcrumb) for list screens */
.cx-page-eyebrow {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 6px;
    color: var(--cx-color-text-subtle);
    font-family: var(--cx-font-family);
    font-size: var(--cx-font-size-eyebrow);
    font-weight: var(--cx-font-weight-semibold);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.cx-page-eyebrow-sep {
    color: var(--cx-color-border-strong);
}

.cx-page-header {
    margin-block-end: var(--cx-space-6);
    padding-block-end: var(--cx-space-4);
    border-block-end: 1px solid var(--cx-color-border);
}

.cx-page-header__back {
    display: inline-flex;
    align-items: center;
    gap: var(--cx-space-2);
    margin-block-end: var(--cx-space-3);
    color: var(--cx-color-text-muted);
    font-family: var(--cx-font-family);
    font-size: var(--cx-font-size-sm);
    font-weight: var(--cx-font-weight-medium);
    text-decoration: none;
}

.cx-page-header__back:hover {
    color: var(--cx-color-primary-hover);
    text-decoration: underline;
}

.cx-page-header__back:focus-visible {
    border-radius: var(--cx-radius-sm);
    outline: 2px solid var(--cx-color-primary);
    outline-offset: var(--cx-space-1);
}

.cx-page-header--back-only {
    display: flex;
    align-items: center;
    height: 36px;
    margin-block-end: 0;
    padding: 0 var(--cx-space-4);
    border-block-end: 1px solid var(--cx-color-border);
}

/* Canonical record pages use the shell width directly. The page primitive
   owns only the compact context strip; the record workspace owns the body. */
.cx-page:has(> .cx-record-workspace),
.cx-page:has(> form > .cx-record-workspace),
.cx-page:has(> .cx-record-form),
.cx-page:has(> form > .cx-record-form) {
    max-width: none;
    margin-inline: 0;
    padding: 0;
}

.cx-page-header--back-only .cx-page-header__back {
    margin-block-end: 0;
}

.cx-page-header__row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--cx-space-6);
}

.cx-page-header__text {
    min-width: 0;
}

.cx-page-header__title {
    margin: 0;
    color: var(--cx-color-text);
    font-family: var(--cx-font-family);
    font-size: var(--cx-font-size-xl);
    font-weight: var(--cx-font-weight-semibold);
    line-height: var(--cx-line-height-tight);
    letter-spacing: -0.01em;
    overflow-wrap: anywhere;
}

.cx-page-header__description {
    max-width: 70ch;
    margin: var(--cx-space-2) 0 0;
    color: var(--cx-color-text-muted);
    font-family: var(--cx-font-family);
    font-size: var(--cx-font-size-sm);
    line-height: 1.5;
}

.cx-page-header__actions {
    display: flex;
    flex: 0 0 auto;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: var(--cx-space-2);
}

@media (max-width: 48rem) {
    .cx-page {
        padding: var(--cx-space-4);
    }

    .cx-page-header {
        margin-block-end: var(--cx-space-4);
    }

    .cx-page-header__row {
        flex-direction: column;
        gap: var(--cx-space-4);
    }

    .cx-page-header__actions {
        width: 100%;
        justify-content: flex-start;
    }

    .cx-page-header--back-only {
        margin-block-end: 0;
        padding-inline: var(--cx-space-3);
    }
}

/* Back link added by corex.page-trail.js to a page without its own (e.g. a list opened from a smart button). */
.cx-page-trail-back {
    margin: var(--cx-space-3) var(--cx-space-4) var(--cx-space-2);
}
