:root {
    --hs-error-bg: #f3f6fb;
    --hs-error-surface: rgba(255,255,255,.96);
    --hs-error-text: #101828;
    --hs-error-muted: #667085;
    --hs-error-border: rgba(148,163,184,.28);
    --hs-error-primary: #315efb;
    --hs-error-primary-strong: #2448d8;
    --hs-error-danger: #c42e43;
    --hs-error-warning: #a85a08;
    --hs-error-info: #1f5ed0;
    --hs-error-success: #087a62;
    --hs-error-shadow: 0 30px 80px rgba(15,23,42,.13);
}

[data-theme="dark"],
html[data-bs-theme="dark"] {
    --hs-error-bg: #07111f;
    --hs-error-surface: rgba(12,26,45,.96);
    --hs-error-text: #edf4ff;
    --hs-error-muted: #a8b5c8;
    --hs-error-border: rgba(148,163,184,.2);
    --hs-error-primary: #6f91ff;
    --hs-error-primary-strong: #5175ef;
    --hs-error-danger: #ff8290;
    --hs-error-warning: #ffc46f;
    --hs-error-info: #76a8ff;
    --hs-error-success: #58d8b4;
    --hs-error-shadow: 0 32px 90px rgba(0,0,0,.42);
}

* { box-sizing: border-box; }

body.hs-error-page {
    margin: 0;
    min-height: 100vh;
    background: var(--hs-error-bg);
    color: var(--hs-error-text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.hs-error-skip {
    position: fixed;
    left: 1rem;
    top: -5rem;
    z-index: 100;
    padding: .75rem 1rem;
    border-radius: 999px;
    background: #fff;
    color: #111827;
    font-weight: 800;
    text-decoration: none;
}
.hs-error-skip:focus { top: 1rem; }

.hs-error-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(320px, .82fr) minmax(520px, 1.18fr);
}

.hs-error-brand-panel {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: clamp(2rem, 5vw, 4.5rem);
    color: #fff;
    background:
        radial-gradient(circle at 76% 18%, rgba(49,94,251,.38), transparent 30%),
        radial-gradient(circle at 12% 88%, rgba(20,184,166,.2), transparent 34%),
        linear-gradient(145deg, #061125 0%, #0a1b36 55%, #10295d 100%);
}
.hs-error-brand-panel::after {
    content: "";
    position: absolute;
    inset: auto -14% -22% auto;
    width: 34rem;
    aspect-ratio: 1;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 50%;
    box-shadow: 0 0 0 46px rgba(255,255,255,.025), 0 0 0 92px rgba(255,255,255,.018);
}

.hs-error-brand,
.hs-error-brand:hover {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: .85rem;
    width: fit-content;
    color: #fff;
    text-decoration: none;
}
.hs-error-brand__mark {
    width: 3rem;
    height: 3rem;
    display: grid;
    place-items: center;
    transform: rotate(45deg);
    border-radius: .35rem;
    background: linear-gradient(135deg, #5c79ff, #2f57df);
    box-shadow: 0 18px 40px rgba(49,94,251,.32);
    font-family: Georgia, serif;
    font-size: 1.4rem;
    font-weight: 800;
}
.hs-error-brand__mark > span { display: block; transform: rotate(-45deg); }
.hs-error-brand > span:last-child { display: flex; align-items: baseline; gap: .35rem; }
.hs-error-brand strong { font-size: 1.12rem; letter-spacing: -.02em; }
.hs-error-brand small { color: #7da0ff; font-size: .75rem; font-weight: 900; letter-spacing: .08em; }

.hs-error-brand-copy { position: relative; z-index: 1; max-width: 34rem; }
.hs-error-kicker,
.hs-error-eyebrow,
.hs-error-recovery__label {
    display: block;
    color: #7696ff;
    font-size: .76rem;
    font-weight: 900;
    letter-spacing: .13em;
    text-transform: uppercase;
}
.hs-error-brand-copy h2 {
    max-width: 10ch;
    margin: 1rem 0 1.1rem;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(3rem, 5vw, 5.2rem);
    font-weight: 500;
    line-height: .96;
    letter-spacing: -.045em;
}
.hs-error-brand-copy p {
    max-width: 34rem;
    margin: 0;
    color: rgba(238,244,255,.74);
    font-size: 1rem;
    line-height: 1.75;
}
.hs-error-brand-points {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    gap: .65rem;
}
.hs-error-brand-points span {
    padding: .58rem .82rem;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 999px;
    background: rgba(255,255,255,.055);
    color: rgba(255,255,255,.82);
    font-size: .78rem;
    font-weight: 750;
}

.hs-error-main {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(1.35rem, 4.5vw, 5rem);
    background:
        radial-gradient(circle at 100% 0%, rgba(49,94,251,.09), transparent 28%),
        var(--hs-error-bg);
}
.hs-error-topbar {
    width: min(760px, 100%);
    display: flex;
    justify-content: space-between;
    margin: 0 auto 1rem;
}
.hs-error-toplink {
    color: var(--hs-error-muted);
    font-size: .82rem;
    font-weight: 800;
    text-decoration: none;
}
.hs-error-toplink:hover { color: var(--hs-error-primary); }

.hs-error-card {
    width: min(760px, 100%);
    margin: 0 auto;
    padding: clamp(1.45rem, 3vw, 2.6rem);
    border: 1px solid var(--hs-error-border);
    border-radius: 2rem;
    background: var(--hs-error-surface);
    box-shadow: var(--hs-error-shadow);
}
.hs-error-card__header {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1.25rem;
    align-items: start;
}
.hs-error-status-orb {
    width: 4.3rem;
    height: 4.3rem;
    display: grid;
    place-items: center;
    border-radius: 1.4rem;
    background: rgba(49,94,251,.1);
    color: var(--hs-error-primary);
    font-weight: 950;
    box-shadow: inset 0 0 0 1px rgba(49,94,251,.12);
}
.hs-error-page--error .hs-error-status-orb { background: rgba(196,46,67,.1); color: var(--hs-error-danger); }
.hs-error-page--warning .hs-error-status-orb { background: rgba(168,90,8,.1); color: var(--hs-error-warning); }
.hs-error-card h1 {
    margin: .42rem 0 .65rem;
    color: var(--hs-error-text);
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2rem, 4vw, 3.8rem);
    font-weight: 500;
    line-height: 1.02;
    letter-spacing: -.04em;
}
.hs-error-card__header p {
    max-width: 44rem;
    margin: 0;
    color: var(--hs-error-muted);
    font-size: 1rem;
    line-height: 1.75;
}

.hs-error-recovery {
    margin-top: 1.5rem;
    padding: 1rem 1.05rem;
    border: 1px solid var(--hs-error-border);
    border-radius: 1.2rem;
    background: rgba(148,163,184,.06);
}
.hs-error-recovery__label { color: var(--hs-error-muted); }
.hs-error-recovery ul { margin: .65rem 0 0; padding-left: 1.2rem; color: var(--hs-error-muted); }
.hs-error-recovery li + li { margin-top: .35rem; }

.hs-error-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    margin-top: 1.45rem;
}
.hs-error-button {
    min-height: 3rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .8rem 1.15rem;
    border-radius: 1rem;
    font-size: .9rem;
    font-weight: 850;
    text-decoration: none;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.hs-error-button:hover { transform: translateY(-1px); }
.hs-error-button--primary {
    color: #fff;
    background: linear-gradient(135deg, var(--hs-error-primary), var(--hs-error-primary-strong));
    box-shadow: 0 16px 36px rgba(49,94,251,.22);
}
.hs-error-button--secondary {
    color: var(--hs-error-text);
    border: 1px solid var(--hs-error-border);
    background: rgba(255,255,255,.04);
}

.hs-error-trace {
    display: grid;
    grid-template-columns: minmax(0, .7fr) minmax(0, 1.3fr) auto;
    gap: .75rem;
    align-items: end;
    margin-top: 1.55rem;
    padding-top: 1.35rem;
    border-top: 1px solid var(--hs-error-border);
}
.hs-error-trace div { min-width: 0; }
.hs-error-trace span { display: block; color: var(--hs-error-muted); font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.hs-error-trace strong { display: block; overflow-wrap: anywhere; margin-top: .25rem; color: var(--hs-error-text); font-size: .82rem; }
.hs-error-copy {
    min-height: 2.65rem;
    padding: .6rem .8rem;
    border: 1px solid var(--hs-error-border);
    border-radius: .85rem;
    background: transparent;
    color: var(--hs-error-text);
    font-weight: 800;
    cursor: pointer;
}
.hs-error-copy:hover { border-color: var(--hs-error-primary); color: var(--hs-error-primary); }
.hs-error-copy-status { grid-column: 1 / -1; min-height: 1em; color: var(--hs-error-success) !important; font-size: .72rem !important; text-transform: none !important; letter-spacing: 0 !important; }
.hs-error-footnote {
    width: min(760px, 100%);
    margin: 1rem auto 0;
    color: var(--hs-error-muted);
    font-size: .78rem;
    line-height: 1.55;
}

/* Shared modern inline error system used by public, auth and workspace views. */
.hs-feedback-card {
    --hs-feedback-tone: var(--hs-error-info);
    display: grid;
    grid-template-columns: auto minmax(0,1fr);
    gap: .75rem;
    align-items: start;
    padding: .9rem 1rem;
    border: 1px solid var(--hs-error-border);
    border: 1px solid color-mix(in srgb, var(--hs-feedback-tone) 25%, transparent);
    border-radius: 1rem;
    background: var(--hs-error-surface);
    background: color-mix(in srgb, var(--hs-feedback-tone) 7%, var(--hs-error-surface));
    color: var(--hs-error-text);
}
.hs-feedback-card--error { --hs-feedback-tone: var(--hs-error-danger); }
.hs-feedback-card--warning { --hs-feedback-tone: var(--hs-error-warning); }
.hs-feedback-card--success { --hs-feedback-tone: var(--hs-error-success); }
.hs-feedback-card__icon {
    width: 2rem;
    height: 2rem;
    display: grid;
    place-items: center;
    border-radius: .7rem;
    background: rgba(49,94,251,.08);
    background: color-mix(in srgb, var(--hs-feedback-tone) 12%, transparent);
    color: var(--hs-feedback-tone);
    font-weight: 950;
}
.hs-feedback-card__title { color: var(--hs-error-text); font-size: .82rem; font-weight: 900; }
.hs-feedback-card__message { margin-top: .15rem; color: var(--hs-error-muted); font-size: .82rem; line-height: 1.5; }
.hs-feedback-card__meta { margin-top: .35rem; color: var(--hs-error-muted); font-size: .7rem; }
.hs-feedback-card__action { display: inline-flex; margin-top: .45rem; color: var(--hs-feedback-tone); font-size: .75rem; font-weight: 850; text-decoration: none; }


/* Legacy Bootstrap alert compatibility: old forms inherit the modern HonourStage feedback language. */
.alert {
    border-radius: 1rem;
    border-width: 1px;
    box-shadow: none;
    font-weight: 650;
    line-height: 1.5;
}
.alert-danger {
    color: var(--hs-error-text);
    border-color: rgba(196,46,67,.24);
    background: rgba(196,46,67,.08);
}
.alert-warning {
    color: var(--hs-error-text);
    border-color: rgba(168,90,8,.24);
    background: rgba(168,90,8,.08);
}
.alert-success {
    color: var(--hs-error-text);
    border-color: rgba(8,122,98,.22);
    background: rgba(8,122,98,.08);
}
.alert-info {
    color: var(--hs-error-text);
    border-color: rgba(31,94,208,.22);
    background: rgba(31,94,208,.07);
}

@media (max-width: 980px) {
    .hs-error-shell { grid-template-columns: 1fr; }
    .hs-error-brand-panel { min-height: 320px; padding: 2rem; }
    .hs-error-brand-copy h2 { max-width: 14ch; font-size: clamp(2.6rem, 8vw, 4.2rem); }
    .hs-error-main { padding: 1.2rem; }
}
@media (max-width: 620px) {
    .hs-error-brand-panel { min-height: 260px; }
    .hs-error-brand-copy p, .hs-error-brand-points { display: none; }
    .hs-error-card { border-radius: 1.4rem; padding: 1.15rem; }
    .hs-error-card__header { grid-template-columns: 1fr; }
    .hs-error-status-orb { width: 3.5rem; height: 3.5rem; border-radius: 1.1rem; }
    .hs-error-actions, .hs-error-actions .hs-error-button { width: 100%; }
    .hs-error-trace { grid-template-columns: 1fr; align-items: stretch; }
    .hs-error-copy { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* Legacy modal/drawer validation surfaces receive a consistent modern treatment. */
.modal .text-danger.small:not(:empty),
.offcanvas .text-danger.small:not(:empty),
.modal [id$="Error"].text-danger:not(:empty),
.offcanvas [id$="Error"].text-danger:not(:empty) {
    display: block;
    margin-top: .75rem !important;
    padding: .72rem .82rem;
    border: 1px solid rgba(196,46,67,.22);
    border-radius: .85rem;
    background: rgba(196,46,67,.07);
    color: var(--hs-error-danger) !important;
    font-weight: 700;
    line-height: 1.45;
}

@media (prefers-color-scheme: dark) {
    body.hs-error-page {
        --hs-error-bg: #07111f;
        --hs-error-surface: rgba(12,26,45,.96);
        --hs-error-text: #edf4ff;
        --hs-error-muted: #a8b5c8;
        --hs-error-border: rgba(148,163,184,.2);
        --hs-error-primary: #6f91ff;
        --hs-error-primary-strong: #5175ef;
        --hs-error-danger: #ff8290;
        --hs-error-warning: #ffc46f;
        --hs-error-info: #76a8ff;
        --hs-error-success: #58d8b4;
        --hs-error-shadow: 0 32px 90px rgba(0,0,0,.42);
    }
}
