/*
   Authentication screens (login, registration, forgot / reset password and their
   confirmation pages). Extends the existing template styles in style.css: it reuses
   the brand palette (primary #405189, info #3da5f4, success #00c689, danger #f1536e,
   dark #08113b) and the sans-serif system font stack, and adds no external resources.

   Everything is scoped under .auth-wrap so nothing else in the application is affected.
*/

.auth-wrap {
    --auth-primary: #405189;
    --auth-primary-dark: #33426f;
    --auth-accent: #3da5f4;
    --auth-success: #00c689;
    --auth-danger: #f1536e;
    --auth-warning: #fda006;
    --auth-ink: #08113b;
    --auth-text: #3b4163;
    --auth-muted: #6c7293;
    --auth-border: #d8dde8;
    --auth-soft: #f4f6fb;
    --auth-radius: 8px;
    width: 100%;
    max-width: 460px;
    margin: 0 auto;
    padding: 2rem 16px;
    color: var(--auth-text);
}

.auth-wrap--wide {
    max-width: 780px;
}

/* ---- Card -------------------------------------------------------------- */

.auth-wrap .auth-card {
    position: relative;
    background: #fff;
    border-radius: 12px;
    padding: 2.25rem 2.25rem 2rem;
    box-shadow: 0 12px 32px rgba(8, 17, 59, 0.14), 0 2px 6px rgba(8, 17, 59, 0.06);
    overflow: hidden;
}

    .auth-wrap .auth-card::before {
        content: "";
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 4px;
        background: linear-gradient(90deg, var(--auth-primary), var(--auth-accent));
    }

.auth-brand {
    text-align: center;
    margin-bottom: 1.25rem;
}

    .auth-brand img {
        width: 140px;
        max-width: 60%;
        height: auto;
    }

.auth-wrap .auth-title {
    margin: 0 0 .35rem;
    text-align: center;
    font-size: 1.4rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--auth-ink);
}

.auth-wrap .auth-subtitle {
    margin: 0 0 1.5rem;
    text-align: center;
    font-size: .9rem;
    line-height: 1.5;
    color: var(--auth-muted);
}

.auth-wrap .auth-title + form,
.auth-wrap .auth-title + .auth-steps {
    margin-top: 1.25rem;
}

/* ---- Step indicator (multi-step flows) ---------------------------------- */

.auth-steps {
    display: flex;
    margin: 0 0 1.5rem;
    padding: 0;
    list-style: none;
    counter-reset: auth-step;
}

    .auth-steps li {
        flex: 1;
        position: relative;
        text-align: center;
        font-size: .75rem;
        color: var(--auth-muted);
        counter-increment: auth-step;
    }

        .auth-steps li::before {
            content: counter(auth-step);
            display: block;
            width: 28px;
            height: 28px;
            margin: 0 auto .3rem;
            line-height: 26px;
            border-radius: 50%;
            border: 2px solid var(--auth-border);
            background: #fff;
            font-weight: 600;
            position: relative;
            z-index: 1;
        }

        .auth-steps li::after {
            content: "";
            position: absolute;
            top: 14px;
            left: -50%;
            width: 100%;
            height: 2px;
            background: var(--auth-border);
        }

        .auth-steps li:first-child::after {
            display: none;
        }

        .auth-steps li.is-done,
        .auth-steps li.is-current {
            color: var(--auth-primary);
        }

            .auth-steps li.is-done::before {
                content: "\2713";
                background: var(--auth-primary);
                border-color: var(--auth-primary);
                color: #fff;
            }

            .auth-steps li.is-done::after,
            .auth-steps li.is-current::after {
                background: var(--auth-primary);
            }

            .auth-steps li.is-current::before {
                border-color: var(--auth-primary);
                color: var(--auth-primary);
                box-shadow: 0 0 0 3px rgba(64, 81, 137, .15);
            }

        .auth-steps li.is-current {
            font-weight: 600;
        }

/* ---- Fields ------------------------------------------------------------- */

.auth-wrap .auth-field {
    margin-bottom: 1.1rem;
}

.auth-wrap .auth-label {
    display: block;
    margin-bottom: .35rem;
    font-size: .8125rem;
    font-weight: 600;
    color: var(--auth-ink);
}

    .auth-wrap .auth-label .auth-req {
        color: var(--auth-danger);
        margin-left: 2px;
    }

.auth-wrap .auth-input {
    display: block;
    width: 100%;
    height: 48px;
    padding: 0 .9rem;
    font-size: .95rem;
    line-height: 1.5;
    color: var(--auth-ink);
    background-color: #fff;
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius);
    box-shadow: none;
    transition: border-color .15s ease, box-shadow .15s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.auth-wrap textarea.auth-input {
    height: auto;
    min-height: 96px;
    padding: .65rem .9rem;
    resize: vertical;
}

.auth-wrap .auth-card select.auth-input {
    color: var(--auth-ink);   /* overrides the template's pale select colour (.auth .auth-form-light select) */
    padding-right: 2.2rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%236c7293' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .9rem center;
}

.auth-wrap .auth-input::placeholder {
    color: #9aa1b9;
    opacity: 1;
}

.auth-wrap .auth-input:hover {
    border-color: #b9c0d3;
}

.auth-wrap .auth-input:focus {
    outline: 0;
    border-color: var(--auth-primary);
    box-shadow: 0 0 0 3px rgba(64, 81, 137, .18);
}

.auth-wrap .auth-input[readonly] {
    background-color: var(--auth-soft);
    color: var(--auth-muted);
    cursor: not-allowed;
}

.auth-wrap .auth-input.input-validation-error {
    border-color: var(--auth-danger);
}

    .auth-wrap .auth-input.input-validation-error:focus {
        box-shadow: 0 0 0 3px rgba(241, 83, 110, .18);
    }

/* Number inputs: no spinner arrows */
.auth-wrap input[type=number].auth-input {
    -moz-appearance: textfield;
}

    .auth-wrap input[type=number].auth-input::-webkit-outer-spin-button,
    .auth-wrap input[type=number].auth-input::-webkit-inner-spin-button {
        -webkit-appearance: none;
        margin: 0;
    }

/* Password input with show / hide button */
.auth-input-wrap {
    position: relative;
}

    .auth-input-wrap .auth-input {
        padding-right: 4.2rem;
    }

.auth-wrap .auth-toggle {
    position: absolute;
    top: 50%;
    right: .5rem;
    transform: translateY(-50%);
    padding: .3rem .55rem;
    font-size: .75rem;
    font-weight: 600;
    color: var(--auth-primary);
    background: transparent;
    border: 0;
    border-radius: 6px;
    cursor: pointer;
}

    .auth-wrap .auth-toggle:hover {
        background: var(--auth-soft);
    }

    .auth-wrap .auth-toggle:focus {
        outline: 0;
        box-shadow: 0 0 0 3px rgba(64, 81, 137, .25);
    }

/* Inline help / validation text */
.auth-wrap .auth-hint {
    display: block;
    margin-top: .35rem;
    font-size: .75rem;
    line-height: 1.4;
    color: var(--auth-muted);
}

    .auth-wrap .auth-hint:empty {
        display: none;
    }

    .auth-wrap .auth-hint.is-error,
    .auth-wrap .auth-hint.is-warn {
        color: var(--auth-danger);
    }

    .auth-wrap .auth-hint.is-ok {
        color: var(--auth-success);
    }

.auth-wrap .auth-error,
.auth-wrap .field-validation-error {
    display: block;
    margin-top: .35rem;
    font-size: .8rem;
    line-height: 1.4;
    color: var(--auth-danger);
}

    .auth-wrap .auth-error:empty,
    .auth-wrap .field-validation-valid {
        display: none;
    }

.auth-wrap .validation-summary-valid {
    display: none;
}

/* Alerts (server-side summary messages) */
.auth-wrap .auth-alert,
.auth-wrap .validation-summary-errors {
    margin-bottom: 1.1rem;
    padding: .7rem .9rem;
    font-size: .85rem;
    line-height: 1.45;
    color: #a1243b;
    background: #fdecef;
    border: 1px solid #f9c4cd;
    border-radius: var(--auth-radius);
}

    .auth-wrap .validation-summary-errors ul {
        margin: 0;
        padding-left: 1.1rem;
    }

.auth-wrap .auth-alert--info {
    color: var(--auth-primary-dark);
    background: #eaf4fe;
    border-color: #bfdffb;
}

.auth-wrap .auth-caps {
    display: none;
    margin-top: .35rem;
    font-size: .75rem;
    color: #a86400;
}

    .auth-wrap .auth-caps.is-on {
        display: block;
    }

/* Form sections (wide registration form) */
.auth-section {
    margin: 1.5rem 0 .9rem;
    padding-bottom: .45rem;
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--auth-primary);
    border-bottom: 1px solid var(--auth-border);
}

    .auth-section:first-of-type {
        margin-top: .25rem;
    }

.auth-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 1rem;
}

.auth-grid--3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.auth-grid .auth-span-2 {
    grid-column: span 2;
}

.auth-grid .auth-span-all {
    grid-column: 1 / -1;
}

/* ---- Buttons ------------------------------------------------------------ */

.auth-actions {
    display: flex;
    flex-direction: column;
    margin-top: 1.5rem;
}

    .auth-actions .auth-btn + .auth-btn {
        margin-top: .65rem;
    }

.auth-wrap .auth-btn {
    display: block;
    width: 100%;
    height: 48px;
    padding: 0 1rem;
    font-size: .95rem;
    font-weight: 600;
    line-height: 46px;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    border: 1px solid transparent;
    border-radius: var(--auth-radius);
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease, color .15s ease;
    -webkit-appearance: none;
    appearance: none;
}

    .auth-wrap .auth-btn:focus {
        outline: 0;
        box-shadow: 0 0 0 3px rgba(64, 81, 137, .3);
    }

.auth-wrap .auth-btn-primary {
    color: #fff;
    background-color: var(--auth-primary);
    border-color: var(--auth-primary);
}

    .auth-wrap .auth-btn-primary:hover {
        color: #fff;
        background-color: var(--auth-primary-dark);
        border-color: var(--auth-primary-dark);
    }

.auth-wrap .auth-btn-success {
    color: #fff;
    background-color: var(--auth-success);
    border-color: var(--auth-success);
}

    .auth-wrap .auth-btn-success:hover {
        color: #fff;
        background-color: #00a874;
        border-color: #00a874;
    }

.auth-wrap .auth-btn-outline {
    color: var(--auth-primary);
    background-color: #fff;
    border-color: var(--auth-primary);
}

    .auth-wrap .auth-btn-outline:hover {
        color: #fff;
        background-color: var(--auth-primary);
    }

.auth-wrap .auth-btn-ghost {
    color: var(--auth-muted);
    background-color: transparent;
    border-color: var(--auth-border);
}

    .auth-wrap .auth-btn-ghost:hover {
        color: var(--auth-ink);
        background-color: var(--auth-soft);
        border-color: #b9c0d3;
    }

.auth-wrap .auth-btn:disabled,
.auth-wrap .auth-btn.is-busy {
    opacity: .65;
    cursor: wait;
}

/* Option tiles (choose how to reset a password) */
.auth-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .9rem;
}

.auth-wrap .auth-option {
    display: block;
    padding: 1.25rem .75rem;
    text-align: center;
    text-decoration: none;
    color: var(--auth-ink);
    background: #fff;
    border: 1px solid var(--auth-border);
    border-radius: 10px;
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

    .auth-wrap .auth-option:hover,
    .auth-wrap .auth-option:focus {
        color: var(--auth-ink);
        text-decoration: none;
        border-color: var(--auth-primary);
        box-shadow: 0 6px 16px rgba(64, 81, 137, .18);
        transform: translateY(-1px);
        outline: 0;
    }

    .auth-wrap .auth-option .auth-option__icon {
        display: block;
        margin-bottom: .5rem;
        font-size: 2rem;
        line-height: 1;
        color: var(--auth-primary);
    }

    .auth-wrap .auth-option .auth-option__title {
        display: block;
        font-weight: 600;
    }

    .auth-wrap .auth-option .auth-option__desc {
        display: block;
        margin-top: .25rem;
        font-size: .75rem;
        color: var(--auth-muted);
    }

/* Divider and secondary links */
.auth-divider {
    display: flex;
    align-items: center;
    margin: 1.25rem 0;
    font-size: .8rem;
    color: var(--auth-muted);
}

    .auth-divider::before,
    .auth-divider::after {
        content: "";
        flex: 1;
        height: 1px;
        background: var(--auth-border);
    }

    .auth-divider span {
        padding: 0 .8rem;
    }

.auth-links {
    margin-top: 1.25rem;
    text-align: center;
    font-size: .875rem;
    color: var(--auth-muted);
}

    .auth-links p {
        margin: 0 0 .5rem;
    }

    .auth-links a,
    .auth-wrap .auth-link-inline {
        font-weight: 600;
        color: var(--auth-primary);
        text-decoration: none;
    }

        .auth-links a:hover,
        .auth-wrap .auth-link-inline:hover {
            color: var(--auth-accent);
            text-decoration: underline;
        }

.auth-field-aside {
    display: flex;
    justify-content: flex-end;
    margin-top: .4rem;
    font-size: .8125rem;
}

.auth-wrap .auth-foot {
    margin: 1rem auto 0;
    padding: .4rem .9rem;
    width: -moz-fit-content;
    width: fit-content;
    max-width: 100%;
    text-align: center;
    font-size: .75rem;
    color: var(--auth-text);
    background: rgba(255, 255, 255, .92);
    border-radius: 999px;
}

    .auth-foot a {
        color: var(--auth-primary);
    }

/* ---- Status screens (confirmation, no licence, locked out) -------------- */

.auth-status {
    text-align: center;
}

.auth-status__icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 1rem;
}

    .auth-status__icon circle {
        fill: rgba(0, 198, 137, .14);
    }

    .auth-status__icon path {
        fill: none;
        stroke: var(--auth-success, #00c689);
        stroke-width: 4;
        stroke-linecap: round;
        stroke-linejoin: round;
        stroke-dasharray: 48;
        stroke-dashoffset: 48;
        animation: auth-draw .6s .15s ease forwards;
    }

.auth-status--info .auth-status__icon circle {
    fill: rgba(61, 165, 244, .15);
}

.auth-status--info .auth-status__icon path {
    stroke: #3da5f4;
}

.auth-status--warn .auth-status__icon circle {
    fill: rgba(241, 83, 110, .13);
}

.auth-status--warn .auth-status__icon path {
    stroke: #f1536e;
}

.auth-status__art {
    display: block;
    max-width: 240px;
    width: 100%;
    margin: 0 auto 1rem;
}

.auth-status__text {
    margin: 0 0 1.25rem;
    font-size: .95rem;
    line-height: 1.6;
    color: var(--auth-text);
}

@keyframes auth-draw {
    to {
        stroke-dashoffset: 0;
    }
}

/* ---- Company picker (SelectCompany/Index) ------------------------------- */

.auth-wrap--md {
    max-width: 620px;
}

.auth-company-search {
    position: relative;
    margin-bottom: 1rem;
}

    .auth-company-search .auth-input {
        padding-left: 2.6rem;
    }

    .auth-company-search::before {
        content: "";
        position: absolute;
        top: 50%;
        left: .95rem;
        width: 16px;
        height: 16px;
        margin-top: -8px;
        background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236c7293' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M21 21l-4.3-4.3'/%3E%3C/svg%3E") no-repeat center;
        pointer-events: none;
    }

.auth-company-count {
    margin: 0 0 .6rem;
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--auth-muted);
}

.auth-company-list {
    max-height: 40vh;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    list-style: none;
}

    .auth-company-list li + li {
        margin-top: .55rem;
    }

    .auth-company-list li[hidden] {
        display: none;
    }

.auth-wrap .auth-company {
    display: flex;
    align-items: center;
    padding: .7rem .9rem;
    color: var(--auth-ink);
    text-decoration: none;
    background: #fff;
    border: 1px solid var(--auth-border);
    border-radius: 10px;
    transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}

    .auth-wrap .auth-company:hover,
    .auth-wrap .auth-company:focus {
        color: var(--auth-ink);
        text-decoration: none;
        background: var(--auth-soft);
        border-color: var(--auth-primary);
        box-shadow: 0 4px 12px rgba(64, 81, 137, .15);
        outline: 0;
    }

.auth-company__avatar {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    margin-right: .85rem;
    line-height: 40px;
    text-align: center;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, var(--auth-primary), var(--auth-accent));
    border-radius: 10px;
}

.auth-company__body {
    flex: 1 1 auto;
    min-width: 0;
}

.auth-company__name {
    display: block;
    overflow: hidden;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.auth-company__meta {
    display: block;
    font-size: .75rem;
    color: var(--auth-muted);
}

.auth-company__go {
    flex: 0 0 auto;
    margin-left: .75rem;
    font-size: .8125rem;
    font-weight: 600;
    color: var(--auth-primary);
}

.auth-company-empty {
    display: none;
    padding: 1.25rem 0;
    text-align: center;
    font-size: .875rem;
    color: var(--auth-muted);
}

    .auth-company-empty.is-on {
        display: block;
    }

/* ---- Small screens ------------------------------------------------------ */

@media (max-width: 575.98px) {
    .auth-wrap {
        padding: 1rem 12px;
    }

        .auth-wrap .auth-card {
            padding: 1.75rem 1.25rem 1.5rem;
        }

    .auth-grid,
    .auth-grid--3,
    .auth-options {
        grid-template-columns: minmax(0, 1fr);
    }

        .auth-grid .auth-span-2 {
            grid-column: auto;
        }

    /* 16px inputs stop iOS from zooming the page on focus */
    .auth-wrap .auth-input {
        font-size: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-status__icon path {
        animation: none;
        stroke-dashoffset: 0;
    }

    .auth-wrap .auth-option,
    .auth-wrap .auth-btn,
    .auth-wrap .auth-input {
        transition: none;
    }
}
