:root {
    --portal-white: #fff;
    --portal-mist: #f5f5f7;
    --portal-ink: #1d1d1f;
    --portal-slate: #707070;
    --portal-hairline: #d6d6d6;
    --portal-blue: #0066cc;
    --portal-button-blue: #0071e3;
    --portal-radius: 28px;
    color-scheme: light;
}

html {
    font-size: 16px;
}

.portal-page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    background: var(--portal-white);
    color: var(--portal-ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    font-size: 17px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.portal-page [hidden] {
    display: none !important;
}

.portal-page .container {
    width: min(100%, 1200px);
    padding-inline: 30px;
}

.portal-page a {
    color: var(--portal-blue);
    text-underline-offset: 4px;
}

.portal-page a:focus-visible,
.portal-page button:focus-visible,
.portal-page input:focus-visible,
.portal-page select:focus-visible,
.portal-page textarea:focus-visible {
    outline: 3px solid var(--portal-blue);
    outline-offset: 4px;
    box-shadow: none;
}

.portal-page ::selection {
    background: #dceeff;
    color: var(--portal-ink);
}

.portal-header {
    background: var(--portal-white);
    border-bottom: 1px solid #e6e6e8;
}

.portal-header-inner {
    display: flex;
    align-items: center;
    gap: 30px;
    min-height: 88px;
    padding-block: 12px;
}

.portal-page .portal-brand {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    gap: 9px;
    min-height: 44px;
    color: var(--portal-ink);
    font-size: 25px;
    font-weight: 600;
    letter-spacing: -1px;
    text-decoration: none;
}

.portal-brand img {
    display: block;
    object-fit: contain;
}

.portal-navigation {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 24px;
}

.portal-navigation a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    font-size: 14px;
    text-decoration: none;
}

.portal-navigation a {
    color: var(--portal-ink);
}

.portal-navigation a:hover,
.portal-navigation a[aria-current="page"] {
    color: var(--portal-blue);
    text-decoration: underline;
}

.portal-language {
    position: relative;
    flex-shrink: 0;
    margin-left: auto;
}

.portal-language summary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    color: var(--portal-blue);
    font-size: 14px;
    list-style: none;
    cursor: pointer;
}

.portal-language summary::-webkit-details-marker {
    display: none;
}

.portal-language summary::after {
    width: 7px;
    height: 7px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    content: "";
    transform: translateY(-2px) rotate(45deg);
}

.portal-language[open] summary::after {
    transform: translateY(2px) rotate(-135deg);
}

.portal-language summary:hover {
    text-decoration: underline;
}

.portal-language summary:focus-visible {
    border-radius: 4px;
    outline: 3px solid var(--portal-blue);
    outline-offset: 4px;
}

.portal-language-list {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 10;
    min-width: 12rem;
    margin: 4px 0 0;
    padding: 6px 0;
    border: 1px solid var(--portal-hairline);
    border-radius: 12px;
    background: var(--portal-white);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    list-style: none;
}

.portal-page .portal-language-list a {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 0 16px;
    color: var(--portal-ink);
    font-size: 14px;
    text-decoration: none;
}

.portal-page .portal-language-list a:hover {
    background: var(--portal-mist);
}

.portal-page .portal-language-list a[aria-current="true"] {
    color: var(--portal-blue);
    font-weight: 600;
}

.portal-page .portal-language-list a:focus-visible {
    outline-offset: -3px;
}

.portal-session {
    min-width: 0;
    max-width: 30rem;
    margin-left: auto;
    text-align: right;
}

.portal-email {
    overflow-wrap: anywhere;
    font-size: 14px;
}

.portal-session-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0 20px;
}

.portal-sign-out-form {
    margin: 0;
}

.portal-sign-out-form .btn-link {
    min-height: 44px;
    padding: 5px 0;
    border: 0;
    border-radius: 4px;
    color: var(--portal-blue);
    font-size: 13px;
    text-decoration: none;
}

.portal-sign-out-form .btn-link:hover {
    text-decoration: underline;
}

.portal-session + .portal-language {
    margin-left: 0;
}

.portal-page .portal-main {
    flex: 1 0 auto;
    width: min(100%, 48rem);
    padding-block: clamp(40px, 6vw, 72px);
}

.portal-main h1 {
    margin-bottom: 28px;
    font-size: clamp(28px, 3.5vw, 36px);
    line-height: 1.15;
    font-weight: 600;
    letter-spacing: -.7px;
    overflow-wrap: break-word;
}

.portal-main p {
    overflow-wrap: anywhere;
}

.portal-sign-in,
.portal-signed-out {
    max-width: 29rem;
    margin-inline: auto;
    padding: 36px;
    border-radius: var(--portal-radius);
    background: var(--portal-mist);
}

.portal-sign-in h1,
.portal-signed-out h1 {
    text-align: center;
}

.portal-main .btn {
    min-height: 46px;
    padding: 11px 23px;
    border-radius: 999px;
    font-size: 15px;
    line-height: 1.4;
    box-shadow: none;
    white-space: normal;
}

.portal-main .btn-primary {
    --bs-btn-bg: var(--portal-button-blue);
    --bs-btn-border-color: var(--portal-button-blue);
    --bs-btn-hover-bg: #0062c6;
    --bs-btn-hover-border-color: #0062c6;
    --bs-btn-active-bg: #005bb8;
    --bs-btn-active-border-color: #005bb8;
    --bs-btn-disabled-bg: var(--portal-button-blue);
    --bs-btn-disabled-border-color: var(--portal-button-blue);
}

.portal-main .btn-outline-dark {
    --bs-btn-bg: var(--portal-white);
    --bs-btn-color: var(--portal-ink);
    --bs-btn-border-color: var(--portal-hairline);
    --bs-btn-hover-color: var(--portal-ink);
    --bs-btn-hover-bg: #e9e9ed;
    --bs-btn-hover-border-color: #b8b8be;
    --bs-btn-active-color: var(--portal-ink);
    --bs-btn-active-bg: #dedee4;
    --bs-btn-active-border-color: #b8b8be;
}

.portal-provider-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.portal-provider-logo {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.portal-main .form-label {
    font-size: 14px;
    font-weight: 500;
}

.portal-main .form-control,
.portal-main .form-select {
    min-height: 48px;
    padding: 12px 16px;
    border-color: var(--portal-hairline);
    border-radius: 14px;
    background-color: var(--portal-white);
    color: var(--portal-ink);
    font-size: 16px;
    box-shadow: none;
}

.portal-main .form-control:focus,
.portal-main .form-select:focus {
    border-color: var(--portal-blue);
}

.portal-main .form-control.is-invalid,
.portal-main .form-select.is-invalid {
    border-color: #b02a37;
}

.portal-main .invalid-feedback {
    font-size: 14px;
}

.portal-main .border-top {
    border-color: var(--portal-hairline) !important;
}

.portal-main .portal-code {
    font-size: 24px;
    letter-spacing: .4rem;
    text-align: center;
}

.portal-code-sent {
    margin-top: 24px;
    color: #555559;
    font-size: 15px;
}

.portal-message {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    border: 0;
    border-radius: 14px;
    font-size: 14px;
}

.portal-message-content {
    min-width: 0;
    overflow-wrap: anywhere;
}

.portal-message ul {
    margin: 0;
    padding-left: 20px;
}

.portal-message li + li {
    margin-top: 6px;
}

.message-icon {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border: 1.5px solid currentColor;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 600;
}

.message-icon::before {
    content: "!";
}

.alert-success .message-icon::before {
    content: "✓";
}

.alert-primary .message-icon::before,
.alert-info .message-icon::before {
    content: "i";
}

.portal-footer {
    padding: 28px 0 20px;
    background: var(--portal-mist);
    color: var(--portal-slate);
    font-size: 12px;
}

.portal-footer-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px 28px;
    padding-bottom: 20px;
}

.portal-footer .portal-brand {
    font-size: 22px;
}

.portal-footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
}

.portal-footer-links a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    color: var(--portal-slate);
    text-decoration: none;
}

.portal-footer-links a:hover {
    color: var(--portal-ink);
    text-decoration: underline;
}

.portal-footer-bottom {
    padding-top: 20px;
    border-top: 1px solid var(--portal-hairline);
}

.portal-page .toast-section {
    position: fixed;
    z-index: 1090;
    inset: auto 24px 24px auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: calc(100vw - 48px);
}

.portal-page .toast {
    width: 350px;
    max-width: 100%;
    border: 1px solid var(--portal-hairline);
    border-left-width: 4px;
    border-radius: 14px;
    background: var(--portal-white);
    color: var(--portal-ink);
    box-shadow: none;
    overflow-wrap: anywhere;
}

.portal-page .toast-body {
    min-width: 0;
}

.portal-page .toast-success { border-left-color: #146c43; }
.portal-page .toast-danger,
.portal-page .toast-validation { border-left-color: #b02a37; }
.portal-page .toast-warning { border-left-color: #997404; }
.portal-page .toast-notification,
.portal-page .toast-idea { border-left-color: var(--portal-blue); }

.portal-page .toast-close {
    flex-shrink: 0;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
}

@media (max-width: 760px) {
    .portal-page .container {
        padding-inline: 24px;
    }

    .portal-header-inner {
        flex-wrap: wrap;
        gap: 4px 20px;
        min-height: 72px;
    }

    .portal-header-inner > .portal-brand { order: 0; }
    .portal-header-inner > .portal-language { order: 1; margin-left: auto; }
    .portal-header-inner > .portal-navigation { order: 2; flex-basis: 100%; }
    .portal-header-inner > .portal-session { order: 3; }

    .portal-session {
        flex-basis: 100%;
        max-width: 100%;
        margin-left: 0;
        padding-top: 4px;
        text-align: left;
    }

    .portal-session-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 540px) {
    .portal-sign-in,
    .portal-signed-out {
        padding: 28px 24px;
    }

    .portal-footer-top {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }

    .portal-main h1 {
        font-size: 28px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .portal-page *,
    .portal-page *::before,
    .portal-page *::after {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
}
