/*
 * Error and status pages (templates/error/_page.html; design canvas
 * "Portal error pages", 2026-11-03): 400, 403, 404, 405, 500, form expired,
 * too many sign-in attempts and signed out. The message sits left; a quiet
 * panel on the right carries the code or an icon over ward-like linework. On a
 * phone the panel becomes a band under the wordmark.
 *
 * Colours are cogta-theme.css tokens only; the page loads cogta-theme.css and
 * this file, not DashLite, so it renders even when little else does. Fonts are
 * the portal's own (Nunito for headings, Roboto for text), from assets/web/fonts.
 */

@font-face { font-family: "Roboto"; font-weight: 400; font-display: swap; src: url("../fonts/Roboto-Regular.9feb0110b6df.woff2") format("woff2"), url("../fonts/Roboto-Regular.94dac78eee40.woff") format("woff"); }
@font-face { font-family: "Roboto"; font-weight: 500; font-display: swap; src: url("../fonts/Roboto-Medium.50d01d3e6c99.woff2") format("woff2"), url("../fonts/Roboto-Medium.9a3bf7acae14.woff") format("woff"); }
@font-face { font-family: "Roboto"; font-weight: 700; font-display: swap; src: url("../fonts/Roboto-Bold.f3a02e2578be.woff2") format("woff2"), url("../fonts/Roboto-Bold.08cb8f797157.woff") format("woff"); }
@font-face { font-family: "Nunito"; font-weight: 700; font-display: swap; src: url("../fonts/Nunito-Bold.28a6dc5d5990.woff2") format("woff2"), url("../fonts/Nunito-Bold.ef78408fe264.woff") format("woff"); }

html, body { margin: 0; }

/* [hidden] wins over the display the boxes and buttons set below. */
.err [hidden] { display: none !important; }

body.err-body {
    background: var(--livi-white);
    color: var(--livi-charcoal);
    font-family: "Roboto", system-ui, -apple-system, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* Tones: the panel's tint and ink. */
.err { --err-tint: var(--livi-forest-tint); --err-ink: var(--livi-forest); --err-pad: clamp(24px, 6vw, 96px); }
.err--gold { --err-tint: var(--livi-amber-bg); --err-ink: var(--livi-amber-text); }
.err--blue { --err-tint: var(--status-open-bg); --err-ink: var(--status-open); }
.err--grey { --err-tint: var(--livi-surface-muted); --err-ink: var(--livi-text-muted-aa); }

.err {
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    grid-template-rows: auto 1fr auto;
    grid-template-areas: "brand panel" "main panel" "foot panel";
}

.err-brand {
    grid-area: brand;
    justify-self: start;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 48px var(--err-pad) 0;
    color: var(--livi-charcoal);
    text-decoration: none;
}

.err-brand img { width: 40px; height: auto; }
.err-brand__text { display: flex; flex-direction: column; line-height: 1; }
.err-brand__livi { font-family: "Nunito", sans-serif; font-weight: 700; font-size: 22px; color: var(--livi-green); }
.err-brand__name { font-size: 10px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; }

.err-main {
    grid-area: main;
    align-self: center;
    display: flex;
    flex-direction: column;
    gap: 24px;
    max-width: 560px;
    padding: 48px var(--err-pad);
}

.err-eyebrow {
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--livi-forest);
}

.err-eyebrow::before {
    content: "";
    width: 24px;
    height: 3px;
    border-radius: 2px;
    background: var(--livi-gold);
}

.err-title {
    margin: 0;
    font-family: "Nunito", sans-serif;
    font-weight: 700;
    font-size: clamp(32px, 4vw, 52px);
    line-height: 1.08;
    letter-spacing: -0.02em;
    color: var(--livi-charcoal);
}

.err-text {
    margin: 0;
    font-size: 17px;
    line-height: 1.6;
    color: var(--livi-text-muted-aa);
}

.err-text strong { font-weight: 500; color: var(--livi-charcoal); }

/* A quiet box under the text: the address asked for, a reference, a timer. */
.err-box {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 8px;
    background: var(--livi-surface-muted);
    border: 1px solid var(--livi-hairline);
    font-size: 15px;
    line-height: 1.5;
}

.err-box > svg { flex: none; color: var(--err-ink); }
.err-box__stack { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.err-box__label { font-size: 12px; font-weight: 500; color: var(--livi-text-muted-aa); }
.err-box__value { font-size: 15px; font-weight: 500; color: var(--livi-charcoal); overflow-wrap: anywhere; }
.err-box__sub { font-size: 13px; color: var(--livi-text-muted-aa); }
.err-code { font-family: "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px; font-weight: 400; }
.err-timer { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 28px; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--livi-charcoal); }

/* The restarting page's retry countdown (deployment/nginx/errors/502.html). */
.err-box--column { flex-direction: column; align-items: stretch; gap: 10px; }
.err-progress { display: block; height: 6px; border-radius: 3px; background: var(--livi-hairline); overflow: hidden; }
.err-progress__bar { display: block; width: 100%; height: 100%; border-radius: 3px; background: var(--livi-forest); transform: scaleX(0); transform-origin: left; transition: transform 1s linear; }

@media (prefers-reduced-motion: reduce) {
    .err-progress__bar { transition: none; }
}

.err-avatar {
    flex: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--livi-forest);
    color: var(--livi-white);
    font-size: 14px;
    font-weight: 700;
}

.err-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding-top: 8px;
}

.err-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 0 22px;
    border: 1px solid var(--livi-forest);
    border-radius: 6px;
    background: var(--livi-forest);
    color: var(--livi-white);
    font: inherit;
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
}

.err-btn:hover { background: var(--livi-forest-text); border-color: var(--livi-forest-text); color: var(--livi-white); }
.err-btn--outline { background: var(--livi-white); color: var(--livi-forest); }
.err-btn--outline:hover { background: var(--livi-forest-tint); color: var(--livi-forest-text); }
.err-btn--quiet { min-height: 44px; padding: 0 14px; border-color: var(--livi-hairline); background: var(--livi-white); color: var(--livi-charcoal); }
.err-btn--quiet:hover { background: var(--livi-surface-muted); color: var(--livi-charcoal); border-color: var(--livi-hairline); }

.err :is(a, button):focus-visible {
    outline: 2px solid var(--livi-forest);
    outline-offset: 2px;
}

.err-foot {
    grid-area: foot;
    margin: 0;
    padding: 0 var(--err-pad) 40px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--livi-text-muted-aa);
}

.err-foot a { color: var(--livi-forest); }

/* The panel: tint, linework and the code or icon. Decorative. */
.err-panel {
    grid-area: panel;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--err-tint);
    color: var(--err-ink);
}

.err-panel__lines {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0.2;
}

.err-panel__code {
    position: relative;
    font-family: "Nunito", sans-serif;
    font-weight: 700;
    font-size: clamp(120px, 14vw, 220px);
    line-height: 1;
    letter-spacing: -0.04em;
    opacity: 0.9;
}

.err-panel > svg:not(.err-panel__lines) { position: relative; }
.err-panel__icon--large { width: clamp(140px, 15vw, 220px); height: auto; }
.err-panel__icon--small { width: 88px; height: 88px; }

/* Phone: wordmark, then the panel as a band, then the message. */
@media (max-width: 767.98px) {
    .err {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto auto 1fr auto;
        grid-template-areas: "brand" "panel" "main" "foot";
    }

    .err-brand { margin: 20px 24px; }
    .err-brand img { width: 34px; }
    .err-panel { height: 150px; flex-direction: row; gap: 12px; }
    .err-panel__code { font-size: 92px; }
    .err-panel__icon--large { width: 96px; }
    .err-panel__icon--small { width: 44px; height: 44px; }
    .err-main { align-self: start; gap: 18px; padding: 28px 24px 24px; }
    .err-title { font-size: 30px; }
    .err-text { font-size: 16px; }
    .err-actions { flex-direction: column; margin-top: auto; }
    .err-actions .err-btn { width: 100%; box-sizing: border-box; }
    .err-foot { padding: 0 24px 24px; text-align: center; }
}

@media print {
    .err-panel { display: none; }
    .err { grid-template-columns: 1fr; grid-template-areas: "brand" "main" "foot"; }
}

/* ---------------------------------------------------------------------------
 * The sign-in and SMS code pages (registration/login.html,
 * registration/two_factor_auth.html; design canvas "Portal sign-in",
 * 2026-11-03). Same layout as the error pages, plus a form.
 * ------------------------------------------------------------------------ */

.err-foot__line { display: block; }

/* Panel: a step number in the lower left instead of a centred code. */
.err-panel--step { align-items: flex-start; justify-content: flex-end; gap: 28px; padding: 72px; }
.err-panel--step .err-panel__lines { animation: err-drift 48s ease-in-out infinite alternate; }
.err-step { position: relative; margin: 0; display: flex; align-items: baseline; gap: 12px; font-family: "Nunito", sans-serif; font-weight: 700; line-height: 0.85; color: var(--livi-forest); }
.err-step__number { font-size: clamp(140px, 15vw, 220px); letter-spacing: -0.05em; }
.err-step__of { font-size: 30px; color: var(--livi-forest-text); }

/* The content rises in on a fresh page; never on an error, so a message is never delayed. */
.err--rise .err-main > * { animation: err-rise 0.7s cubic-bezier(0.16, 1, 0.3, 1) both; }
.err--rise .err-main > *:nth-child(2) { animation-delay: 0.05s; }
.err--rise .err-main > *:nth-child(3) { animation-delay: 0.1s; }
.err--rise .err-main > *:nth-child(4) { animation-delay: 0.15s; }
.err--rise .err-main > *:nth-child(5) { animation-delay: 0.2s; }
.err--rise .err-main > *:nth-child(n+6) { animation-delay: 0.25s; }
@keyframes err-rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes err-drift { to { transform: translate3d(-28px, 14px, 0) scale(1.05); } }

.err-btn { transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.2s ease; }
.err-btn:active:not(:disabled) { transform: scale(0.98); }
.err-btn:disabled { cursor: default; opacity: 0.6; }
.err-btn--block { width: 100%; box-sizing: border-box; }

/* A form under the heading. */
.err-form { display: flex; flex-direction: column; gap: 20px; margin: 0; }
.err-field { display: flex; flex-direction: column; gap: 8px; }
.err-label { font-size: 14px; font-weight: 500; color: var(--livi-charcoal); }
.err-hint { margin: 0; font-size: 14px; line-height: 1.45; color: var(--livi-text-muted-aa); }

.err-input {
    height: 48px;
    box-sizing: border-box;
    padding: 0 14px;
    border: 1px solid var(--livi-field-border);
    border-radius: 6px;
    background: var(--livi-white);
    color: var(--livi-charcoal);
    font: inherit;
    font-size: 16px; /* 16px: phones do not zoom into the field */
}

.err-input::placeholder { color: var(--livi-text-muted-aa); opacity: 1; }
.err-input:focus-visible { outline: 2px solid var(--livi-forest); outline-offset: 2px; }
.err-input[aria-invalid="true"], .err-pw[data-invalid] { border-color: var(--livi-red); }

/* Password with its Show button inside one edge. */
.err-pw { display: flex; align-items: stretch; border: 1px solid var(--livi-field-border); border-radius: 6px; background: var(--livi-white); }
.err-pw .err-input { flex: 1; min-width: 0; height: 46px; border: 0; border-radius: 6px 0 0 6px; }
.err-pw__toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 88px;
    min-height: 46px;
    padding: 0 14px;
    border: 0;
    border-left: 1px solid var(--livi-hairline);
    border-radius: 0 6px 6px 0;
    background: var(--livi-surface-muted);
    color: var(--livi-charcoal);
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

/* Cloudflare's check, as wide as the fields (data-size="flexible"). */
.err-check { width: 100%; min-height: 65px; }
.err-check > * { width: 100%; }

/* Submitting: a thin bar runs along the bottom of the button. */
.err-btn[data-busy] { position: relative; overflow: hidden; }
.err-btn__load { display: none; }
.err-btn[data-busy] .err-btn__load { display: block; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--livi-white); opacity: 0.8; transform-origin: left; animation: err-load 1.1s cubic-bezier(0.16, 1, 0.3, 1) infinite; }
@keyframes err-load { from { transform: translateX(-100%) scaleX(0.5); } to { transform: translateX(100%) scaleX(0.5); } }

/* Messages above the form. */
.err-alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border: 1px solid var(--livi-red); border-radius: 8px; background: var(--livi-red-tint); font-size: 15px; line-height: 1.5; color: var(--livi-charcoal); }
.err-alert > svg { flex: none; margin-top: 2px; color: var(--livi-red); }
.err-alert__stack { display: flex; flex-direction: column; gap: 4px; }
.err-alert__title { font-weight: 500; }
.err-alert--ok { border-color: var(--livi-forest); background: var(--livi-forest-tint); }
.err-alert--ok > svg { color: var(--livi-forest); }
.err-alert:focus-visible { outline: 2px solid var(--livi-forest); outline-offset: 2px; }

/* The SMS code: six boxes drawn over one real input, so typing, pasting and
   the phone's SMS autofill all work. Without script the input shows as is. */
.err-otp { position: relative; width: 100%; max-width: 392px; height: 64px; }
.err-otp .err-input { width: 100%; height: 100%; font-family: "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 24px; letter-spacing: 0.3em; }
.err-otp__cells { display: none; }
.err-otp.is-enhanced .err-otp__cells { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; height: 100%; }
.err-otp.is-enhanced .err-input { position: absolute; inset: 0; opacity: 0; cursor: text; }
.err-otp__cell {
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    border: 1px solid var(--livi-field-border);
    border-radius: 8px;
    background: var(--livi-white);
    font-family: "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 28px;
    font-weight: 500;
    color: var(--livi-charcoal);
}
.err-otp__cell.is-filled { border-color: var(--livi-forest); }
.err-otp__cell.is-active { border: 2px solid var(--livi-forest); box-shadow: 0 0 0 3px var(--livi-forest-tint); }
.err-otp__cell.is-active:empty::after { content: ""; width: 2px; height: 30px; background: var(--livi-forest); animation: err-blink 1s step-end infinite; }
.err-otp[data-invalid] .err-otp__cell { border-color: var(--livi-red); }
@keyframes err-blink { 50% { opacity: 0; } }

/* "No SMS yet?" */
.err-more { display: flex; flex-direction: column; gap: 12px; padding-top: 20px; border-top: 1px solid var(--livi-hairline); }
.err-more__title { margin: 0; font-size: 15px; font-weight: 500; }
.err-more__row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.err-more__row form { margin: 0; }
.err-link { display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px; font-size: 15px; color: var(--livi-forest); }

@media (max-width: 767.98px) {
    .err-panel--step { padding: 0; align-items: center; justify-content: center; }
    .err-panel--step .err-step { display: none; }
    .err-otp { height: 58px; }
    .err-otp.is-enhanced .err-otp__cells { gap: 8px; }
    .err-otp__cell { font-size: 26px; }
    .err-more__row { flex-direction: column; align-items: stretch; }
    .err-more__row .err-btn { width: 100%; box-sizing: border-box; }
    .err-link { justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
    .err--rise .err-main > *, .err-panel--step .err-panel__lines, .err-otp__cell.is-active:empty::after { animation: none; }
    .err-btn { transition: none; }
    .err-btn[data-busy] .err-btn__load { animation: none; }
}

/* Cloudflare's check renders nothing where it is switched off. */
.err-check:empty { display: none; }
