/**
 * ERROR PAGE
 */
.error-body {
    --as-tone: var(--color-error-tone-error);
    --as-tone-bg: var(--color-error-tone-error-bg);
}

.error-body.tone-info {
    --as-tone: var(--color-error-tone-info);
    --as-tone-bg: var(--color-error-tone-info-bg);
}

.error-body.tone-rights {
    --as-tone: var(--color-error-tone-rights);
    --as-tone-bg: var(--color-error-tone-rights-bg);
}

/**
 * PAGE
 */
.error-body {
    flex: 1 1 0;
    min-height: 0;
    height: 100%;
    width: 100%;
    display: flex;
    padding: 24px;
    box-sizing: border-box;
    overflow: auto;
    background: var(--color-error-page-bg);
    color: var(--color-error-title);
    font-family: var(--font-error);
    font-size: 14px;
    line-height: 1.45;
}

/* The global rules of site.css force the skin font on these elements */
.error-body span:not(.fa, .fab, .fad, .fal, .far, .fas, .as),
.error-body button,
.error-body input,
.error-body textarea,
.error-body select,
.error-body table {
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
}

.error-cols {
    margin: auto;
    width: min(1120px, 100%);
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 18px;
    align-items: stretch;
}

.error-cols.is-single {
    grid-template-columns: minmax(0, 640px);
    justify-content: center;
}

.error-col {
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-width: 0;
}

/* The last card of each column fills the column: both columns have the same height */
.error-col > .error-card:last-child {
    flex: 1 1 auto;
}

.error-side-card {
    display: flex;
    flex-direction: column;
}

.error-card {
    min-width: 0;
    box-sizing: border-box;
    padding: 24px 26px;
    background: var(--color-panel-bg);
    border-radius: 16px;
    box-shadow: var(--box-shadow-error-card);
}

/**
 * SUMMARY
 */
.error-title {
    margin: 10px 0 4px 0;
    font-family: inherit;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 0;
    color: var(--color-error-title);
}

.error-lead {
    margin: 0 0 16px 0;
    font-size: 15px;
    color: var(--color-error-muted);
}

.error-msg {
    position: relative;
    padding: 20px 120px 22px 24px;
    border: solid var(--color-error-line);
    border-width: 1px 1px 1px 0;
    border-radius: 10px;
}

.error-body .error-msg-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
}

.error-msg-text {
    margin-top: 6px;
    max-height: 250px;
    overflow-y: auto;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.5;
    word-break: break-word;
    white-space: pre-line;
}

.error-msg .error-copy-clipboard-ico {
    position: absolute;
    top: 12px;
    right: 12px;
    color: var(--as-tone);
}

    .error-msg .error-copy-clipboard-ico:hover {
        background: color-mix(in srgb, var(--as-tone) 14%, transparent);
    }

    .error-msg .error-copy-clipboard-ico:focus-visible {
        outline-color: var(--as-tone);
    }

.error-hint {
    margin: 14px 0 4px 0;
    color: var(--color-error-muted);
}

.error-note {
    margin: 0 0 12px 0;
    font-size: 12px;
    color: var(--color-error-muted);
}

.error-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

    .error-actions .as-btn {
        min-width: 0;
        min-height: 40px;
        margin: 0 !important;
        padding: .6em 1.4em;
        align-self: auto;
        font-size: 14px;
        font-weight: 600;
    }

    .error-actions .as-btn span {
        font-size: inherit;
    }

.error-meta {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 14px;
    row-gap: 6px;
    margin: 18px 0 0 0;
    padding-top: 14px;
    border-top: 1px solid var(--color-error-line);
    font-size: 11px;
    opacity: .75;
}

.error-meta-row {
    display: contents;
}

    .error-meta-row dt {
        color: var(--color-error-muted);
    }

    .error-meta-row dd {
        margin: 0;
        font-weight: 400;
        color: var(--color-error-muted);
        text-align: right;
        word-break: break-all;
    }

/**
 * SMALL LINK BUTTONS
 */
.error-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 30px;
    padding: 0 10px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--color-error-link);
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

    .error-link-btn:hover {
        background: var(--color-error-soft);
    }

    .error-link-btn:focus-visible,
    .error-opt:focus-visible {
        outline: 2px solid var(--color-error-link);
        outline-offset: 2px;
    }

    .error-link-btn.has-border {
        border-color: var(--color-error-line);
    }

    .error-link-btn span {
        font-size: inherit;
        font-weight: inherit;
    }

/**
 * DIAGNOSTIC (admins, errors only)
 */
.error-card-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

    .error-card-head h2 {
        flex: 1;
        margin: 0;
        font-family: inherit;
        font-size: 17px;
        font-weight: 700;
        color: var(--color-error-title);
    }

.error-admin-tag {
    --as-tone: var(--color-error-muted);
    --as-tone-bg: var(--color-error-soft);
    border: 1px solid var(--color-error-line);
    font-size: 11px !important;
}

.error-diag-toggle i {
    transition: transform .2s;
}

.error-diag.is-collapsed .error-diag-toggle i {
    transform: rotate(-90deg);
}

.error-diag.is-collapsed .error-diag-body {
    display: none;
}

.error-diag.is-collapsed .error-card-head {
    margin-bottom: 0;
}

.error-stack-tools {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.error-frames {
    position: relative;
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 300px;
    overflow: auto;
}

    .error-frames::before {
        content: "";
        position: absolute;
        left: 5px;
        top: 14px;
        bottom: 14px;
        width: 2px;
        background: var(--color-error-line);
    }

    .error-frames:not(.show-framework) .error-frame.is-framework {
        display: none;
    }

.error-frame {
    position: relative;
    display: grid;
    grid-template-columns: 18px 1fr auto;
    gap: 10px;
    padding: 7px 0;
}

    .error-frame.is-framework {
        opacity: .6;
    }

.error-frame-dot {
    width: 12px;
    height: 12px;
    margin-top: 4px;
    box-sizing: border-box;
    border-radius: 50%;
    background: var(--color-panel-bg);
    border: 2px solid var(--color-error-muted);
}

.error-frame.is-origin .error-frame-dot {
    background: var(--as-tone);
    border-color: var(--as-tone);
}

.error-frame-info b {
    font-size: 13px;
    font-weight: 600;
    word-break: break-word;
}

.error-frame-info code {
    display: block;
    font-family: var(--font-mono, ui-monospace, Consolas, monospace);
    font-size: 11px;
    color: var(--color-error-muted);
}

.error-body .error-frame-line {
    padding-top: 2px;
    font-family: var(--font-mono, ui-monospace, Consolas, monospace);
    font-size: 11px;
    color: var(--color-error-muted);
}

.error-body .error-frame-tag {
    margin-left: 8px;
    padding: 1px 7px;
    border-radius: 99px;
    background: var(--as-tone-bg);
    color: var(--as-tone);
    font-size: 10px;
    font-weight: 700;
}

/**
 * SIDE CARD: options (info) and access request (rights)
 */
.error-opts {
    display: grid;
    gap: 10px;
}

.error-opt {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 14px 16px;
    box-sizing: border-box;
    background: var(--color-panel-bg);
    border: 1px solid var(--color-error-line);
    border-radius: 12px;
    color: var(--color-error-title);
    text-align: start;
    cursor: pointer;
}

    .error-opt:hover {
        background: var(--color-error-soft);
        border-color: var(--color-error-link);
    }

.error-opt-ico {
    flex: none;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: var(--as-tone-bg);
    color: var(--as-tone);
}

.error-opt-txt {
    flex: 1;
}

    .error-opt-txt b,
    .error-opt-txt small {
        display: block;
    }

    .error-opt-txt b {
        font-weight: 600;
    }

    .error-opt-txt small {
        font-size: 12px;
        color: var(--color-error-muted);
    }

.error-opt-arrow {
    color: var(--color-error-muted);
}

/**
 * SUPPORT FORM INSIDE THE SIDE CARD (rendered by Support.view)
 * Its own header is replaced by the header of the card
 */
.error-support-form {
    width: 100%;
}

    /* The form fills the card, the buttons stay at the bottom */
    .error-support-form:not(.hide) {
        flex: 1 1 auto;
        display: flex;
        flex-direction: column;
    }

    .error-support-form .support-panel,
    .error-support-form .support-panel > main {
        flex: 1 1 auto;
        display: flex;
        flex-direction: column;
    }

    .error-support-form .support-panel > main > form {
        flex: 1 1 auto;
    }

    .error-support-form .support-actions {
        margin-top: auto;
        padding-top: 16px;
    }

    .error-support-form .left-border,
    .error-support-form .support-panel .panel-header {
        display: none;
    }

    .error-support-form .support-panel {
        padding: 0;
        margin: 0;
        background: transparent;
        border: 0;
        box-shadow: none;
    }

/**
 * MODAL: one column, no card, diagnostic collapsed
 */
.error-body.is-modal {
    position: relative;
    flex: none;
    height: auto;
    width: auto;
    display: block;
    padding: .5em 2em 2em 2em;
    background: none;
    overflow: visible;
}

    .error-body.is-modal .error-cols {
        display: block;
        width: 100%;
    }

    .error-body.is-modal .error-col {
        gap: 0;
    }

    .error-body.is-modal .error-card {
        padding: 0;
        background: transparent;
        box-shadow: none;
    }

    .error-body.is-modal .error-title {
        font-size: 19px;
    }

    .error-body.is-modal .error-msg {
        padding: 16px 110px 18px 20px;
    }

    .error-body.is-modal .error-msg-text {
        font-size: 14px;
    }

    .error-body.is-modal .error-meta {
        display: flex;
        flex-wrap: wrap;
        gap: 4px 14px;
    }

    .error-body.is-modal .error-meta-row {
        display: flex;
        gap: 4px;
    }

    .error-body.is-modal .error-meta-row dd {
        text-align: start;
    }

    .error-body.is-modal .error-diag {
        margin-top: 14px;
        padding-top: 14px;
        border-top: 1px solid var(--color-error-line);
        border-radius: 0;
    }

    .error-body.is-modal .error-actions .as-btn {
        flex: 0 0 auto;
    }

.error-close-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 1;
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--color-error-muted);
    font-size: 16px;
    cursor: pointer;
}

    .error-close-btn:hover {
        background: var(--color-error-soft);
        color: var(--color-error-title);
    }

    .error-close-btn:focus-visible {
        outline: 2px solid var(--color-error-link);
        outline-offset: 2px;
    }

@media only screen and (max-width: 900px) {
    .error-cols {
        grid-template-columns: minmax(0, 1fr);
    }

    .error-card {
        padding: 20px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .error-diag-toggle i {
        transition: none;
    }
}