/* Unified entry flow for the student, driver, and administration portals. */
.portal-entry-page .portal-entry-shell {
    display: grid;
    width: min(1120px, 100%);
    min-height: calc(100dvh - 96px);
    place-items: center;
    padding-block: clamp(1rem, 4vw, 3rem);
}

.portal-entry {
    position: relative;
    isolation: isolate;
    width: 100%;
    overflow: hidden;
    border: 1px solid var(--ou-border);
    border-radius: 28px;
    padding: clamp(1rem, 3.4vw, 2.5rem);
    background:
        radial-gradient(circle at 12% 15%, rgba(183, 138, 69, 0.12), transparent 19rem),
        linear-gradient(145deg, rgba(255, 253, 249, 0.99), rgba(245, 238, 227, 0.98));
    box-shadow: var(--ou-shadow-md);
}

.portal-entry::after {
    position: absolute;
    inset-inline: 0;
    inset-block-end: 0;
    height: 5px;
    content: '';
    background: linear-gradient(90deg, var(--ou-red-500), var(--ou-accent), var(--ou-green-500));
}

.portal-entry__header {
    display: grid;
    justify-items: center;
    margin-inline: auto;
    margin-block-end: clamp(1.25rem, 3vw, 2rem);
    text-align: center;
}

.portal-entry__logo {
    width: clamp(78px, 9vw, 108px);
    aspect-ratio: 1;
    border: 1px solid rgba(154, 100, 47, 0.16);
    border-radius: 24px;
    background: #fff var(--platform-logo-url, url('/icons/icon.svg')) center / 82% auto no-repeat;
    box-shadow: 0 15px 32px rgba(74, 55, 35, 0.13);
}

.portal-entry__eyebrow {
    margin: 0.9rem 0 0.25rem;
    color: var(--ou-secondary);
    font-size: 0.86rem;
    font-weight: 900;
}

.portal-entry__header h1 {
    margin: 0;
    color: var(--ou-text);
    font-size: clamp(1.8rem, 5vw, 3.15rem);
    font-weight: 950;
    letter-spacing: -0.03em;
}

.portal-entry-grid {
    display: grid;
    min-width: 0;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.portal-card {
    position: relative;
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr) 28px;
    align-items: center;
    gap: 0.85rem;
    min-height: 118px;
    overflow: hidden;
    border: 1px solid var(--ou-border-strong);
    border-radius: 20px;
    padding: 1.1rem;
    background: #fff;
    color: var(--ou-text);
    box-shadow: var(--ou-shadow-sm);
    transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.portal-card::after {
    position: absolute;
    inset-inline: 0;
    inset-block-end: 0;
    height: 4px;
    content: '';
    background: var(--portal-accent, var(--ou-primary));
}

.portal-card:hover,
.portal-card:focus-visible {
    border-color: var(--portal-accent, var(--ou-primary));
    color: var(--ou-text);
    outline: 0;
    transform: translateY(-3px);
    box-shadow: 0 18px 36px rgba(53, 41, 27, 0.14);
}

.portal-card:focus-visible {
    box-shadow: 0 0 0 4px rgba(8, 127, 115, 0.14), 0 18px 36px rgba(53, 41, 27, 0.14);
}

.portal-card--student {
    --portal-accent: var(--ou-primary);
}

.portal-card--driver {
    --portal-accent: var(--ou-secondary);
}

.portal-card--admin {
    --portal-accent: var(--ou-accent);
}

.portal-card__icon {
    display: grid;
    width: 58px;
    height: 58px;
    place-items: center;
    border-radius: 18px;
    background: rgba(154, 100, 47, 0.09);
    background: color-mix(in srgb, var(--portal-accent, var(--ou-primary)) 11%, white);
    color: var(--portal-accent, var(--ou-primary));
}

.portal-card__icon svg {
    width: 30px;
    height: 30px;
}

.portal-card__copy,
.portal-card__copy strong,
.portal-card__copy small {
    display: block;
    min-width: 0;
}

.portal-card__copy strong {
    font-size: clamp(1rem, 1.6vw, 1.15rem);
    font-weight: 950;
}

.portal-card__copy small {
    margin-block-start: 0.18rem;
    color: var(--ou-text-muted);
    font-size: 0.78rem;
    font-weight: 800;
}

.portal-card__arrow {
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    border-radius: 50%;
    background: var(--ou-surface-2);
    color: var(--portal-accent, var(--ou-primary));
    font-size: 1.05rem;
    font-weight: 950;
}

[dir='ltr'] .portal-card__arrow {
    transform: scaleX(-1);
}

.portal-entry__registration {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
    margin-block-start: 1.25rem;
    border-block-start: 1px solid var(--ou-border);
    padding-block-start: 1.25rem;
}

.portal-entry__registration .button {
    min-width: min(230px, 100%);
}

.portal-entry__secondary {
    border-color: rgba(8, 127, 115, 0.32) !important;
    background: rgba(8, 127, 115, 0.06) !important;
    color: var(--ou-secondary) !important;
}

/* The public phone form keeps one authentication backend with a clear portal context. */
.login-page > .flash {
    display: none;
}

.login-page .login-form-card {
    max-width: 590px;
    overflow: hidden;
}

.portal-switcher {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.45rem;
    border: 1px solid var(--ou-border);
    border-radius: 16px;
    padding: 0.35rem;
    background: var(--ou-surface-2);
}

.portal-switcher a {
    display: flex;
    min-width: 0;
    min-height: 50px;
    align-items: center;
    justify-content: center;
    gap: 0.38rem;
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 0.45rem 0.55rem;
    color: var(--ou-text-muted);
    font-size: 0.78rem;
    font-weight: 900;
    text-align: center;
    transition: border-color 160ms ease, background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.portal-switcher a:hover,
.portal-switcher a:focus-visible {
    border-color: var(--ou-border-strong);
    background: #fff;
    color: var(--ou-text);
    outline: 0;
}

.portal-switcher a[aria-current='page'] {
    border-color: rgba(8, 127, 115, 0.25);
    background: #fff;
    color: var(--ou-secondary);
    box-shadow: 0 7px 18px rgba(53, 41, 27, 0.08);
}

.portal-switcher svg {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.auth-inline-alert {
    display: grid;
    gap: 0.25rem;
    border: 1px solid;
    border-radius: 13px;
    padding: 0.75rem 0.85rem;
    font-size: 0.84rem;
    font-weight: 800;
    line-height: 1.6;
}

.auth-inline-alert span {
    display: block;
}

.auth-inline-alert.is-error {
    border-color: rgba(177, 42, 42, 0.23);
    background: rgba(177, 42, 42, 0.08);
    color: #8f2424;
}

.auth-inline-alert.is-success {
    border-color: rgba(57, 122, 75, 0.24);
    background: rgba(57, 122, 75, 0.09);
    color: #2c633b;
}

.login-page [aria-invalid='true'] {
    border-color: var(--ou-danger) !important;
}

@media (min-width: 640px) and (max-width: 920px) {
    .portal-entry-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .portal-card--admin {
        grid-column: 1 / -1;
    }
}

@media (max-width: 639px) {
    .portal-entry-page .portal-entry-shell {
        min-height: calc(100dvh - 78px);
        padding: 0.75rem;
    }

    .portal-entry {
        border-radius: 20px;
        padding: 1rem;
    }

    .portal-entry-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 0.7rem;
    }

    .portal-card {
        min-height: 92px;
        grid-template-columns: 50px minmax(0, 1fr) 28px;
        padding: 0.85rem;
    }

    .portal-card__icon {
        width: 50px;
        height: 50px;
        border-radius: 15px;
    }

    .portal-card__icon svg {
        width: 26px;
        height: 26px;
    }

    .portal-entry__registration {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
    }

    .portal-entry__registration .button {
        width: 100%;
        min-width: 0;
    }
}

@media (max-width: 480px) {
    .portal-entry-page .topbar {
        gap: 0.5rem;
        padding-inline: 0.75rem;
    }

    .portal-entry-page .brand {
        grid-template-columns: 42px minmax(0, 1fr);
        gap: 0.55rem;
        font-size: 0.9rem;
    }

    .portal-entry-page .brand::before {
        width: 42px;
        height: 42px;
    }

    .portal-entry-page .brand small {
        font-size: 0.67rem;
    }

    .portal-entry-page .language-switch {
        padding-inline: 0.6rem;
    }

    .portal-switcher {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .portal-switcher a:last-child {
        grid-column: 1 / -1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .portal-card,
    .portal-switcher a {
        transition: none;
    }
}
