/* Unified error pages for admin/API browser fallbacks. */
:root {
    --ep-navy: #0b1e3d;
    --ep-navy-dark: #061429;
    --ep-navy-light: #1f3a5f;
    --ep-green: #10b981;
    --ep-amber: #f59e0b;
    --ep-red: #ef4444;
    --ep-blue: #0ea5e9;
    --ep-text: #0f172a;
    --ep-muted: #64748b;
    --ep-border: #dbe4ef;
    --ep-surface: #ffffff;
    --ep-soft: #f7fafc;
    --ep-accent: var(--ep-blue);
    --ep-accent-strong: #075985;
    --ep-accent-soft: #e0f2fe;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body.error-shell {
    min-height: 100vh;
    margin: 0;
    color: var(--ep-text);
    background: #f5f8fb;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    letter-spacing: 0;
}

body.error-shell::before {
    position: fixed;
    inset: 0;
    z-index: -2;
    content: "";
    background:
        linear-gradient(135deg, rgba(11, 30, 61, 0.06) 0 1px, transparent 1px) 0 0 / 28px 28px,
        linear-gradient(180deg, #ffffff 0%, #f7fafc 54%, #eef5f7 100%);
}

body.error-shell::after {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: -1;
    height: 40vh;
    content: "";
    background: linear-gradient(90deg, rgba(11, 30, 61, 0.05), rgba(16, 185, 129, 0.08), rgba(245, 158, 11, 0.06));
    clip-path: polygon(0 34%, 30% 18%, 62% 32%, 100% 0, 100% 100%, 0 100%);
}

.error-shell--403,
.error-shell--500 {
    --ep-accent: var(--ep-red);
    --ep-accent-strong: #991b1b;
    --ep-accent-soft: #fee2e2;
}

.error-shell--502,
.error-shell--503,
.error-shell--service {
    --ep-accent: var(--ep-amber);
    --ep-accent-strong: #92400e;
    --ep-accent-soft: #fef3c7;
}

.ep-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 32px 20px;
}

.ep-frame {
    display: grid;
    width: min(1040px, 100%);
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 20px;
    align-items: stretch;
}

.ep-main,
.ep-side {
    border: 1px solid rgba(11, 30, 61, 0.08);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 24px 70px rgba(11, 30, 61, 0.11), 0 8px 20px rgba(15, 23, 42, 0.04);
}

.ep-main {
    padding: 38px;
}

.ep-side {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 24px;
}

.ep-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 34px;
}

.ep-mark {
    display: block;
    width: 46px;
    height: 34px;
    object-fit: contain;
}

.ep-brand-text strong,
.ep-side-title {
    display: block;
    color: var(--ep-navy);
    font-size: 14px;
    font-weight: 700;
}

.ep-brand-text span,
.ep-side-copy,
.ep-meta span,
.ep-status-text {
    color: var(--ep-muted);
    font-size: 13px;
}

.ep-status-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 18px;
}

.ep-badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 10px;
    border: 1px solid rgba(11, 30, 61, 0.08);
    border-radius: 999px;
    background: var(--ep-accent-soft);
    color: var(--ep-accent-strong);
    font-size: 12px;
    font-weight: 700;
}

.ep-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ep-accent);
    box-shadow: 0 0 0 5px color-mix(in srgb, var(--ep-accent) 16%, transparent);
}

.ep-code {
    margin: 0 0 18px;
    color: var(--ep-navy);
    font-size: clamp(76px, 13vw, 150px);
    font-weight: 800;
    line-height: 0.9;
    letter-spacing: 0;
}

.ep-code--text {
    font-size: clamp(56px, 9vw, 96px);
}

.ep-main h1 {
    max-width: 720px;
    margin: 0;
    color: var(--ep-text);
    font-size: clamp(28px, 4vw, 42px);
    line-height: 1.1;
    font-weight: 800;
    letter-spacing: 0;
}

.ep-message {
    max-width: 680px;
    margin: 16px 0 0;
    color: #475569;
    font-size: 15px;
    line-height: 1.75;
}

.ep-meta {
    display: flex;
    max-width: 680px;
    align-items: flex-start;
    gap: 12px;
    margin-top: 22px;
    padding: 14px 16px;
    border: 1px solid var(--ep-border);
    border-radius: 8px;
    background: var(--ep-soft);
}

.ep-meta code {
    overflow-wrap: anywhere;
    color: var(--ep-navy);
    font-family: "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 13px;
}

.ep-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 30px;
}

.ep-button {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border: 1px solid var(--ep-border);
    border-radius: 8px;
    color: var(--ep-navy);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.ep-button:hover,
.ep-button:focus {
    border-color: var(--ep-navy);
    outline: none;
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(11, 30, 61, 0.12);
}

.ep-button--primary {
    border-color: var(--ep-navy);
    background: var(--ep-navy);
    color: #ffffff;
}

.ep-side-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.ep-signal {
    display: inline-flex;
    width: 34px;
    height: 34px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--ep-accent-soft);
    color: var(--ep-accent-strong);
    font-weight: 800;
}

.ep-checklist {
    display: grid;
    gap: 12px;
    margin: 22px 0;
}

.ep-check {
    display: grid;
    grid-template-columns: 10px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    color: #334155;
    font-size: 13px;
    line-height: 1.5;
}

.ep-check::before {
    width: 8px;
    height: 8px;
    margin-top: 6px;
    border-radius: 50%;
    background: var(--ep-green);
    content: "";
}

.ep-reference {
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid var(--ep-border);
    color: var(--ep-muted);
    font-size: 12px;
    line-height: 1.6;
}

@media (max-width: 820px) {
    .ep-frame {
        grid-template-columns: 1fr;
    }

    .ep-main,
    .ep-side {
        padding: 24px;
    }
}

@media (max-width: 520px) {
    .ep-page {
        padding: 16px;
    }

    .ep-brand {
        margin-bottom: 26px;
    }

    .ep-actions {
        display: grid;
    }

    .ep-button {
        width: 100%;
    }
}
