.amt-error-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(5, 7, 15, 0.76);
    backdrop-filter: blur(2px);
}

.amt-error-dialog {
    width: min(45rem, 100%);
    max-height: min(80vh, 48rem);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--mud-palette-divider, #dedee7);
    border-radius: 0.75rem;
    background: var(--mud-palette-surface, #ffffff);
    color: var(--mud-palette-text-primary, #262631);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.38);
    outline: none;
}

.amt-error-header {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem 1.5rem 0.75rem;
}

.amt-error-status-icon {
    width: 4rem;
    height: 4rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    border: 1px solid var(--mud-palette-error, #d32f2f);
    border-radius: 50%;
    color: var(--mud-palette-error, #d32f2f);
    background: color-mix(in srgb, var(--mud-palette-error, #d32f2f) 10%, transparent);
    box-shadow: 0 0 0 0.75rem color-mix(in srgb, var(--mud-palette-error, #d32f2f) 9%, transparent);
}

.amt-error-status-icon svg {
    width: 2rem;
    height: 2rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.3;
    stroke-linecap: round;
}

.amt-error-title {
    margin: 0 0 0 0.25rem;
    font: inherit;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.25;
    color: inherit;
}

.amt-error-icon-button,
.amt-error-details-toggle,
.amt-error-copy-button,
.amt-error-close-button {
    font: inherit;
}

.amt-error-icon-button {
    width: 2.5rem;
    height: 2.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: start;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--mud-palette-text-secondary, #72727f);
    cursor: pointer;
}

.amt-error-icon-button:hover {
    background: color-mix(in srgb, currentColor 9%, transparent);
}

.amt-error-icon-button:focus-visible,
.amt-error-details-toggle:focus-visible,
.amt-error-copy-button:focus-visible,
.amt-error-close-button:focus-visible {
    outline: 2px solid var(--mud-palette-primary, #594ae2);
    outline-offset: 2px;
}

.amt-error-icon-button svg {
    width: 1.125rem;
    height: 1.125rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
}

.amt-error-body {
    min-height: 0;
    overflow-y: auto;
    padding: 0.5rem 1.5rem 1rem;
}

.amt-error-message {
    margin: 0 0 1.25rem;
    font-size: 1rem;
    line-height: 1.55;
    color: var(--mud-palette-text-primary, #262631);
}

.amt-error-details-panel {
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--mud-palette-error, #d32f2f) 25%, var(--mud-palette-divider, #dedee7));
    border-radius: 0.625rem;
    background: color-mix(in srgb, var(--mud-palette-error, #d32f2f) 7%, var(--mud-palette-surface, #ffffff));
}

.amt-error-details-header {
    min-height: 3rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0 0.875rem;
}

.amt-error-details-toggle,
.amt-error-copy-button {
    min-height: 2.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border: 0;
    border-radius: 0.375rem;
    background: transparent;
    cursor: pointer;
}

.amt-error-details-toggle {
    min-width: 0;
    flex: 1 1 auto;
    justify-content: flex-start;
    padding: 0.25rem 0.25rem;
    color: var(--mud-palette-text-primary, #262631);
    font-weight: 600;
    text-align: left;
}

.amt-error-details-chevron {
    width: 1.25rem;
    height: 1.25rem;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform 140ms ease;
}

.amt-error-details-chevron.is-expanded {
    transform: rotate(180deg);
}

.amt-error-copy-button {
    flex: none;
    padding: 0.25rem 0.5rem;
    color: var(--mud-palette-primary, #594ae2);
    font-weight: 500;
}

.amt-error-copy-button:hover,
.amt-error-details-toggle:hover {
    background: color-mix(in srgb, currentColor 7%, transparent);
}

.amt-error-copy-button svg {
    width: 1.2rem;
    height: 1.2rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.amt-error-details-content {
    padding: 0 0.875rem 0.875rem;
}

.amt-error-details {
    max-height: 16rem;
    overflow: auto;
    margin: 0;
    padding: 0.875rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 0.5rem;
    background: #11131d;
    color: #e7e8ef;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 0.78rem;
    line-height: 1.55;
}

.amt-error-footer {
    display: flex;
    justify-content: flex-end;
    padding: 1rem 1.5rem 1.25rem;
    border-top: 1px solid var(--mud-palette-divider, #dedee7);
}

.amt-error-close-button {
    min-width: 7rem;
    min-height: 2.75rem;
    padding: 0.625rem 1.25rem;
    border: 0;
    border-radius: 0.5rem;
    background: var(--mud-palette-primary, #594ae2);
    color: var(--mud-palette-primary-text, #ffffff);
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 6px 16px color-mix(in srgb, var(--mud-palette-primary, #594ae2) 26%, transparent);
}

.amt-error-close-button:hover {
    filter: brightness(1.06);
}

.amt-error-close-button:active {
    transform: translateY(1px);
}

.amt-fatal-error {
    padding: 2rem;
    text-align: center;
    color: var(--mud-palette-text-primary, #262631);
}

.amt-fatal-error button {
    min-height: 2.75rem;
    margin-top: 0.75rem;
    padding: 0.625rem 1.25rem;
    border: 0;
    border-radius: 0.5rem;
    background: var(--mud-palette-primary, #594ae2);
    color: var(--mud-palette-primary-text, #ffffff);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

@media (max-width: 599.98px) {
    .amt-error-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .amt-error-dialog {
        width: 100%;
        max-height: 90vh;
        border-width: 1px 0 0;
        border-radius: 0.875rem 0.875rem 0 0;
    }

    .amt-error-header {
        gap: 0.875rem;
        padding: 1.25rem 1rem 0.75rem;
    }

    .amt-error-status-icon {
        width: 3rem;
        height: 3rem;
        box-shadow: 0 0 0 0.45rem color-mix(in srgb, var(--mud-palette-error, #d32f2f) 8%, transparent);
    }

    .amt-error-status-icon svg {
        width: 1.5rem;
        height: 1.5rem;
    }

    .amt-error-title {
        margin-left: 0;
        font-size: 1.25rem;
    }

    .amt-error-body {
        padding: 0.5rem 1rem 1rem;
    }

    .amt-error-footer {
        padding: 0.875rem 1rem calc(0.875rem + env(safe-area-inset-bottom));
    }

    .amt-error-close-button {
        width: 100%;
    }

    .amt-error-copy-button span {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .amt-error-details-chevron {
        transition: none;
    }
}
