:root {
    --auth-ink: #111820;
    --auth-ink-soft: #18212c;
    --auth-yellow: #ffbf18;
    --auth-yellow-deep: #f2ac00;
    --auth-text: #171b22;
    --auth-muted: #747b88;
    --auth-line: #e2e5e9;
    --auth-surface: #fff;
    --auth-canvas: #f5f6f8;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body.safematic-auth {
    background: var(--auth-canvas);
    color: var(--auth-text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    margin: 0;
}

.safematic-auth-shell {
    display: grid;
    min-height: 100vh;
    grid-template-columns: minmax(25rem, .9fr) minmax(32rem, 1.35fr);
}

.safematic-auth-brand {
    background:
        linear-gradient(145deg, rgb(255 191 24 / 7%), transparent 40%),
        radial-gradient(circle at 75% 20%, rgb(255 191 24 / 12%), transparent 28%),
        var(--auth-ink);
    color: #fff;
    min-height: 100vh;
    overflow: hidden;
    padding: clamp(2rem, 4vw, 4.5rem);
    position: relative;
}

.safematic-auth-brand::before {
    background-image: linear-gradient(rgb(255 255 255 / 3%) 1px, transparent 1px), linear-gradient(90deg, rgb(255 255 255 / 3%) 1px, transparent 1px);
    background-size: 46px 46px;
    content: "";
    inset: 0;
    mask-image: linear-gradient(to bottom, #000, transparent 78%);
    position: absolute;
}

.safematic-auth-brand::after {
    border: 1px solid rgb(255 191 24 / 24%);
    border-radius: 50%;
    bottom: -16rem;
    content: "";
    height: 34rem;
    position: absolute;
    right: -14rem;
    width: 34rem;
}

.safematic-auth-brand-glow {
    background: var(--auth-yellow);
    border-radius: 50%;
    filter: blur(75px);
    height: 12rem;
    opacity: .12;
    position: absolute;
    right: -6rem;
    top: 28%;
    width: 12rem;
}

.safematic-auth-brand-content {
    align-items: center;
    display: flex;
    height: 100%;
    isolation: isolate;
    justify-content: center;
    min-height: calc(100vh - clamp(4rem, 8vw, 9rem));
    position: relative;
    z-index: 1;
}

.safematic-auth-logo {
    height: auto;
    max-width: 21rem;
    width: min(78%, 21rem);
}

.safematic-auth-form-pane {
    align-items: center;
    background:
        radial-gradient(circle at 90% 10%, rgb(255 191 24 / 8%), transparent 25rem),
        var(--auth-canvas);
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    padding: clamp(1.5rem, 5vw, 5rem);
    position: relative;
}

.safematic-auth-mobile-brand {
    display: none;
}

.safematic-auth-card {
    background: rgb(255 255 255 / 96%);
    border: 1px solid rgb(226 229 233 / 90%);
    border-radius: 1.25rem;
    box-shadow: 0 24px 70px rgb(17 24 32 / 10%);
    max-width: 31rem;
    padding: clamp(1.5rem, 3.5vw, 2.75rem);
    width: 100%;
}

.safematic-auth-heading {
    align-items: center;
    display: flex;
    gap: .9rem;
    margin-bottom: 2rem;
}

.safematic-auth-heading-icon {
    align-items: center;
    background: rgb(255 191 24 / 14%);
    border: 1px solid rgb(255 191 24 / 35%);
    border-radius: .8rem;
    color: #8f6500;
    display: inline-flex;
    flex: 0 0 3rem;
    font-size: 1.35rem;
    height: 3rem;
    justify-content: center;
}

.safematic-auth-heading h1 {
    color: var(--auth-text);
    font-size: clamp(1.55rem, 2.8vw, 1.95rem);
    font-weight: 750;
    letter-spacing: -.025em;
    line-height: 1.1;
    margin: 0;
}

.safematic-auth-heading p {
    color: var(--auth-muted);
    font-size: .88rem;
    margin: .35rem 0 0;
}

.safematic-auth-alert {
    align-items: flex-start;
    border: 1px solid;
    border-radius: .75rem;
    display: flex;
    font-size: .82rem;
    gap: .65rem;
    line-height: 1.45;
    margin-bottom: 1.25rem;
    padding: .8rem .9rem;
}

.safematic-auth-alert p {
    margin: 0;
}

.safematic-auth-alert-error {
    background: #fff2f1;
    border-color: #ffc8c4;
    color: #a82b24;
}

.safematic-auth-alert-success {
    background: #effbf3;
    border-color: #bce8c9;
    color: #18723a;
}

.safematic-auth-form {
    display: grid;
    gap: 1.1rem;
}

.safematic-auth-field {
    display: grid;
    gap: .45rem;
}

.safematic-auth-field > span:first-child {
    color: #333842;
    font-size: .77rem;
    font-weight: 700;
}

.safematic-auth-input {
    align-items: center;
    background: #fff;
    border: 1px solid var(--auth-line);
    border-radius: .72rem;
    display: flex;
    min-height: 3rem;
    position: relative;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.safematic-auth-input:focus-within {
    border-color: var(--auth-yellow-deep);
    box-shadow: 0 0 0 3px rgb(255 191 24 / 16%);
}

.safematic-auth-input i {
    align-items: center;
    bottom: 0;
    color: #969ca7;
    display: flex;
    font-size: 1.05rem;
    justify-content: center;
    left: 0;
    line-height: 1;
    pointer-events: none;
    position: absolute;
    top: 0;
    width: 3rem;
}

.safematic-auth-input input {
    background: transparent;
    border: 0;
    color: var(--auth-text);
    font: inherit;
    height: 3rem;
    min-width: 0;
    outline: 0;
    padding: 0 .9rem 0 3rem;
    width: 100%;
}

.safematic-auth-input input::placeholder {
    color: #a2a7b0;
}

.safematic-auth-remember {
    align-items: flex-start;
    color: #555c67;
    cursor: pointer;
    display: flex;
    font-size: .78rem;
    gap: .55rem;
    line-height: 1.35;
}

.safematic-auth-remember input {
    accent-color: var(--auth-yellow-deep);
    flex: 0 0 auto;
    height: 1rem;
    margin: .05rem 0 0;
    width: 1rem;
}

.safematic-auth-submit {
    align-items: center;
    background: linear-gradient(135deg, var(--auth-yellow), #ffca35);
    border: 1px solid #e6a500;
    border-radius: .72rem;
    box-shadow: 0 9px 20px rgb(242 172 0 / 22%);
    color: #171717;
    cursor: pointer;
    display: flex;
    font: inherit;
    font-size: .88rem;
    font-weight: 750;
    gap: .55rem;
    justify-content: center;
    min-height: 3.05rem;
    transition: transform .15s ease, box-shadow .15s ease;
    width: 100%;
}

.safematic-auth-submit:hover {
    box-shadow: 0 12px 25px rgb(242 172 0 / 30%);
    transform: translateY(-1px);
}

.safematic-auth-submit:focus-visible {
    outline: 3px solid rgb(255 191 24 / 35%);
    outline-offset: 2px;
}

.safematic-auth-help {
    border-top: 1px solid var(--auth-line);
    color: var(--auth-muted);
    font-size: .72rem;
    line-height: 1.55;
    margin: 1.65rem 0 0;
    padding-top: 1.15rem;
    text-align: center;
}

.safematic-auth-footer {
    bottom: clamp(1rem, 2.5vw, 2rem);
    color: #8b919c;
    display: flex;
    font-size: .7rem;
    gap: 1.25rem;
    justify-content: space-between;
    left: clamp(1.5rem, 5vw, 5rem);
    max-width: 31rem;
    position: absolute;
    right: clamp(1.5rem, 5vw, 5rem);
    width: calc(100% - clamp(3rem, 10vw, 10rem));
}

.safematic-auth-environment {
    align-items: center;
    display: inline-flex;
    gap: .4rem;
}

.safematic-auth-environment i {
    background: var(--auth-yellow);
    border-radius: 50%;
    height: .42rem;
    width: .42rem;
}

@media (max-width: 900px) {
    .safematic-auth-shell {
        grid-template-columns: 1fr;
    }

    .safematic-auth-brand {
        display: none;
    }

    .safematic-auth-form-pane {
        justify-content: flex-start;
        min-height: 100vh;
        padding: 1.5rem;
    }

    .safematic-auth-mobile-brand {
        display: block;
        margin: .75rem auto 2rem;
        max-width: 13rem;
        width: 54%;
    }

    .safematic-auth-mobile-brand img {
        display: block;
        height: auto;
        width: 100%;
    }

    .safematic-auth-footer {
        margin-top: 2rem;
        max-width: 31rem;
        position: static;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .safematic-auth-form-pane {
        padding: 1rem;
    }

    .safematic-auth-mobile-brand {
        margin-bottom: 1.35rem;
        max-width: 14.5rem;
        width: 68%;
    }

    .safematic-auth-card {
        border-radius: 1rem;
        box-shadow: 0 18px 45px rgb(17 24 32 / 9%);
        padding: 1.35rem;
    }

    .safematic-auth-heading {
        margin-bottom: 1.45rem;
    }

    .safematic-auth-heading-icon {
        flex-basis: 3rem;
        font-size: 1.4rem;
        height: 3rem;
    }

    .safematic-auth-input {
        min-height: 3.35rem;
    }

    .safematic-auth-input i {
        font-size: 1.25rem;
        width: 3.35rem;
    }

    .safematic-auth-input input {
        height: 3.35rem;
        padding-left: 3.35rem;
    }

    .safematic-auth-footer {
        align-items: center;
        flex-direction: column;
        gap: .5rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .safematic-auth-input,
    .safematic-auth-submit {
        transition: none;
    }
}
