:root {
    --ink: #171b22;
    --ink-soft: #4c5562;
    --navy: #111a27;
    --navy-2: #182638;
    --red: #c61f2b;
    --red-dark: #a81822;
    --surface: #ffffff;
    --canvas: #eef1f4;
    --field: #f6f7f9;
    --line: #d9dee5;
    --muted: #68717d;
    --focus: #246bce;
    --alert-bg: #fff1f2;
    --alert-line: #f1b6bb;
    --portal-accent: #df3540;
    --portal-image: none;
    --portal-position: center;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    min-height: 100%;
    background: var(--canvas);
}

body {
    min-width: 320px;
    min-height: 100%;
    margin: 0;
    color: var(--ink);
    background: var(--canvas);
    font-family: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body.portal-gov-buyer {
    --portal-accent: #e23c47;
    --portal-image: url("/images/portal/gov-buyer.jpg");
    --portal-position: 54% center;
}

body.portal-supplier-mfg {
    --portal-accent: #f05a37;
    --portal-image: url("/images/portal/supplier-mfg.jpg");
    --portal-position: 50% center;
}

body.portal-team {
    --portal-accent: #ef4854;
    --portal-image: url("/images/portal/team.jpg");
    --portal-position: 54% center;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

.skip-link {
    position: fixed;
    z-index: 100;
    top: 12px;
    left: 12px;
    padding: 10px 14px;
    transform: translateY(-150%);
    border-radius: 6px;
    color: #fff;
    background: var(--navy);
    font-weight: 700;
    text-decoration: none;
    transition: transform 160ms ease;
}

.skip-link:focus {
    transform: translateY(0);
}

.portal-layout {
    min-height: 100vh;
    min-height: 100svh;
    display: grid;
    grid-template-columns: minmax(0, 56fr) minmax(430px, 44fr);
    align-items: start;
}

.visual-panel {
    position: sticky;
    top: 0;
    isolation: isolate;
    min-height: 100vh;
    min-height: 100svh;
    overflow: hidden;
    color: #fff;
    background-color: var(--navy);
    background-image:
        linear-gradient(115deg, rgba(5, 11, 19, 0.94) 0%, rgba(7, 15, 25, 0.82) 43%, rgba(8, 18, 29, 0.54) 100%),
        linear-gradient(0deg, rgba(3, 8, 14, 0.34), rgba(3, 8, 14, 0.08)),
        var(--portal-image);
    background-position: center, center, var(--portal-position);
    background-repeat: no-repeat;
    background-size: cover;
}

.visual-panel::before {
    position: absolute;
    z-index: -1;
    inset: 0;
    content: "";
    background:
        linear-gradient(90deg, var(--portal-accent) 0 7px, transparent 7px),
        linear-gradient(138deg, transparent 0 72%, rgba(255, 255, 255, 0.08) 72% 72.15%, transparent 72.15%);
    pointer-events: none;
}

.visual-panel::after {
    position: absolute;
    z-index: -1;
    right: -90px;
    bottom: 10%;
    width: 390px;
    height: 6px;
    content: "";
    transform: rotate(-28deg);
    border-radius: 99px;
    background: var(--portal-accent);
    box-shadow:
        0 -28px 0 rgba(255, 255, 255, 0.1),
        0 28px 0 rgba(255, 255, 255, 0.07);
    opacity: 0.86;
    pointer-events: none;
}

.visual-grid {
    position: absolute;
    z-index: -1;
    inset: 0;
    opacity: 0.09;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.28) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.28) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: linear-gradient(120deg, #000, transparent 70%);
    pointer-events: none;
}

.visual-inner {
    width: min(100%, 920px);
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    padding: clamp(32px, 4.5vw, 72px);
}

.portal-topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.brand-mark {
    width: clamp(200px, 18vw, 248px);
    flex: 0 1 248px;
    display: block;
    padding: 11px 14px 9px;
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.24);
}

.brand-mark img {
    width: 100%;
    height: auto;
    display: block;
}

.brand-mark:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 4px;
}

.portal-topbar-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    padding-top: 2px;
}

.secure-portal-label {
    display: flex;
    align-items: center;
    gap: 7px;
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    white-space: nowrap;
}

.secure-portal-label svg {
    width: 17px;
    height: 17px;
    flex: 0 0 auto;
    color: var(--portal-accent);
}

.back-to-site {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 12px;
    border: 1px solid rgba(255, 255, 255, 0.42);
    border-radius: 8px;
    color: #fff;
    background: rgba(5, 11, 19, 0.38);
    font-size: 0.74rem;
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
    backdrop-filter: blur(8px);
    transition:
        border-color 160ms ease,
        background-color 160ms ease,
        transform 160ms ease;
}

.back-to-site svg {
    width: 17px;
    height: 17px;
    flex: 0 0 auto;
}

.back-to-site:hover {
    border-color: #fff;
    background: rgba(5, 11, 19, 0.62);
    transform: translateY(-1px);
}

.back-to-site:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 3px;
}

.visual-message {
    width: min(100%, 680px);
    margin: auto 0 clamp(38px, 6vh, 72px);
    padding-top: 64px;
}

.visual-eyebrow,
.access-label {
    margin: 0;
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.17em;
    text-transform: uppercase;
}

.visual-eyebrow {
    display: flex;
    align-items: center;
    gap: 13px;
    color: #fff;
}

.visual-eyebrow::before {
    width: 38px;
    height: 3px;
    content: "";
    border-radius: 99px;
    background: var(--portal-accent);
}

.visual-message h1 {
    max-width: 690px;
    margin: 18px 0 0;
    font-size: clamp(2.5rem, 4.3vw, 4.55rem);
    font-weight: 750;
    line-height: 1.02;
    letter-spacing: -0.052em;
    text-wrap: balance;
}

.visual-summary {
    max-width: 600px;
    margin: 24px 0 0;
    color: rgba(255, 255, 255, 0.78);
    font-size: clamp(1rem, 1.2vw, 1.12rem);
    line-height: 1.72;
}

.portal-capabilities {
    max-width: 620px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin: clamp(32px, 4.5vh, 48px) 0 0;
    padding: 0;
    list-style: none;
}

.portal-capabilities li {
    min-width: 0;
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 12px;
    background: rgba(10, 18, 28, 0.44);
    backdrop-filter: blur(10px);
}

.capability-check {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    margin-bottom: 12px;
    border-radius: 8px;
    color: #fff;
    background: var(--portal-accent);
}

.capability-check svg {
    width: 17px;
    height: 17px;
}

.portal-capabilities strong,
.portal-capabilities small {
    display: block;
}

.portal-capabilities strong {
    font-size: 0.86rem;
    line-height: 1.35;
}

.portal-capabilities small {
    margin-top: 5px;
    color: rgba(255, 255, 255, 0.64);
    font-size: 0.74rem;
    line-height: 1.5;
}

.visual-disclaimer {
    max-width: 540px;
    margin: 0;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.73rem;
    line-height: 1.55;
}

.auth-panel {
    min-height: 100vh;
    min-height: 100svh;
    display: grid;
    place-items: center;
    padding: clamp(34px, 5vw, 76px);
    background:
        radial-gradient(circle at 100% 0, rgba(198, 31, 43, 0.055), transparent 22rem),
        linear-gradient(150deg, rgba(246, 247, 249, 0.82), transparent 44%),
        var(--surface);
}

.auth-inner {
    width: min(100%, 470px);
    padding: 12px 0;
}

.portal-switcher {
    display: grid;
    grid-template-columns: 1fr 1.22fr 0.82fr;
    gap: 5px;
    margin-bottom: 34px;
    padding: 5px;
    border: 1px solid #dfe4e9;
    border-radius: 13px;
    background: #f0f2f5;
}

.portal-option {
    min-width: 0;
    min-height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 9px;
    border: 1px solid transparent;
    border-radius: 9px;
    color: #59626e;
    font-size: clamp(0.7rem, 0.86vw, 0.8rem);
    font-weight: 800;
    letter-spacing: 0.005em;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    transition:
        color 160ms ease,
        border-color 160ms ease,
        background-color 160ms ease,
        box-shadow 160ms ease,
        transform 160ms ease;
}

.portal-option:hover {
    border-color: #d2d8df;
    color: var(--ink);
    background: #fff;
    box-shadow: 0 3px 10px rgba(17, 26, 39, 0.07);
}

.portal-option.is-active {
    border-color: var(--navy);
    color: #fff;
    background: var(--navy);
    box-shadow: 0 6px 16px rgba(17, 26, 39, 0.2);
}

.portal-option:focus-visible {
    z-index: 1;
    outline: 3px solid var(--focus);
    outline-offset: 2px;
}

.access-label {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--red);
}

.access-label span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--red);
    box-shadow: 0 0 0 5px rgba(198, 31, 43, 0.1);
}

.auth-header {
    margin-top: 18px;
}

.auth-header h2 {
    margin: 0;
    color: var(--ink);
    font-size: clamp(2rem, 3.4vw, 2.7rem);
    font-weight: 750;
    line-height: 1.08;
    letter-spacing: -0.043em;
    text-wrap: balance;
}

.auth-header p {
    margin: 13px 0 0;
    color: var(--muted);
    line-height: 1.65;
}

.portal-policy-note {
    display: grid;
    grid-template-columns: 30px 1fr;
    gap: 12px;
    align-items: start;
    margin-top: 22px;
    padding: 14px 15px;
    border: 1px solid #ead3d6;
    border-left: 4px solid var(--red);
    border-radius: 10px;
    color: #5f2930;
    background:
        linear-gradient(135deg, rgba(198, 31, 43, 0.055), transparent 65%),
        #fff8f8;
}

.portal-policy-icon,
.portal-policy-icon svg {
    width: 27px;
    height: 27px;
}

.portal-policy-icon {
    color: var(--red);
}

.portal-policy-note p {
    margin: 0;
    font-size: 0.79rem;
    line-height: 1.55;
}

.portal-policy-note strong,
.portal-policy-note span {
    display: block;
}

.portal-policy-note strong {
    margin-bottom: 3px;
    color: #342126;
    font-size: 0.83rem;
}

.login-form + .portal-policy-note {
    margin-top: 24px;
}

.portal-policy-note + .account-help {
    margin-top: 18px;
}

.auth-alert {
    display: grid;
    grid-template-columns: 24px 1fr;
    gap: 11px;
    align-items: start;
    margin-top: 24px;
    padding: 13px 14px;
    border: 1px solid var(--alert-line);
    border-left: 4px solid var(--red);
    border-radius: 9px;
    color: #771720;
    background: var(--alert-bg);
    font-size: 0.88rem;
    line-height: 1.5;
}

.auth-alert:focus {
    outline: 3px solid rgba(198, 31, 43, 0.22);
    outline-offset: 2px;
}

.auth-alert-icon,
.auth-alert-icon svg {
    width: 22px;
    height: 22px;
}

.login-form {
    display: grid;
    gap: 21px;
    margin-top: 30px;
}

.form-group {
    display: grid;
    gap: 8px;
}

.form-group label {
    color: #2c323a;
    font-size: 0.86rem;
    font-weight: 750;
}

.field-shell {
    position: relative;
}

.field-shell input {
    width: 100%;
    min-height: 54px;
    padding: 13px 54px 13px 47px;
    border: 1.5px solid var(--line);
    border-radius: 10px;
    outline: none;
    color: var(--ink);
    background: var(--field);
    box-shadow: inset 0 1px 2px rgba(17, 26, 39, 0.025);
    transition:
        border-color 150ms ease,
        background-color 150ms ease,
        box-shadow 150ms ease;
}

.field-shell input::placeholder {
    color: #939ba5;
}

.field-shell input:hover {
    border-color: #bfc6cf;
}

.field-shell input:focus {
    border-color: var(--focus);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(36, 107, 206, 0.12);
}

.field-shell input[aria-invalid="true"] {
    border-color: #cb3f49;
}

.field-icon {
    position: absolute;
    z-index: 1;
    top: 50%;
    left: 15px;
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    transform: translateY(-50%);
    color: #7d8691;
    pointer-events: none;
}

.field-icon svg {
    width: 22px;
    height: 22px;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 9px;
    min-width: 44px;
    min-height: 40px;
    padding: 7px 8px;
    transform: translateY(-50%);
    border: 0;
    border-radius: 7px;
    color: #4e5864;
    background: transparent;
    font-size: 0.75rem;
    font-weight: 800;
}

.password-toggle:hover {
    color: var(--ink);
    background: #e8ebef;
}

.password-toggle:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 1px;
}

.password-toggle .hide-label {
    display: none;
}

.password-toggle[aria-pressed="true"] .show-label {
    display: none;
}

.password-toggle[aria-pressed="true"] .hide-label {
    display: inline;
}

.field-hint {
    margin: 0;
    color: var(--muted);
    font-size: 0.76rem;
}

.submit-button {
    width: 100%;
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 11px;
    margin-top: 3px;
    padding: 13px 18px;
    border: 1px solid var(--red);
    border-radius: 10px;
    color: #fff;
    background: var(--red);
    box-shadow: 0 10px 24px rgba(198, 31, 43, 0.2);
    font-weight: 800;
    transition:
        background-color 150ms ease,
        border-color 150ms ease,
        box-shadow 150ms ease,
        transform 150ms ease;
}

.submit-button svg {
    width: 22px;
    height: 22px;
    transition: transform 150ms ease;
}

.submit-button:hover:not(:disabled) {
    border-color: var(--red-dark);
    background: var(--red-dark);
    box-shadow: 0 12px 27px rgba(168, 24, 34, 0.24);
    transform: translateY(-1px);
}

.submit-button:hover:not(:disabled) svg {
    transform: translateX(3px);
}

.submit-button:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 3px;
}

.submit-button:disabled {
    cursor: wait;
    opacity: 0.76;
}

.submit-button.is-submitting svg {
    animation: nudge 900ms ease-in-out infinite;
}

.account-help {
    display: grid;
    grid-template-columns: 28px 1fr;
    gap: 12px;
    align-items: start;
    margin-top: 30px;
    padding: 16px;
    border: 1px solid #e1e5ea;
    border-radius: 10px;
    background: #f8f9fa;
}

.account-help-icon,
.account-help-icon svg {
    width: 25px;
    height: 25px;
}

.account-help-icon {
    color: var(--red);
}

.account-help p {
    margin: 0;
    color: var(--muted);
    font-size: 0.8rem;
    line-height: 1.55;
}

.account-help strong {
    display: block;
    margin-bottom: 2px;
    color: #313740;
}

.account-help a {
    border-radius: 2px;
    color: var(--red-dark);
    font-weight: 800;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

.account-help a:hover {
    color: var(--red);
}

.account-help a:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
}

.credential-note {
    margin: 17px 0 0;
    color: #78818c;
    font-size: 0.72rem;
    text-align: center;
}

.portal-footer {
    margin-top: 26px;
    padding-top: 21px;
    border-top: 1px solid #e4e7eb;
    color: #8a929c;
    font-size: 0.72rem;
    text-align: center;
}

@keyframes nudge {
    0%,
    100% {
        transform: translateX(0);
    }
    50% {
        transform: translateX(4px);
    }
}

@media (max-width: 1180px) {
    .portal-layout {
        grid-template-columns: minmax(0, 47fr) minmax(430px, 53fr);
    }

    .visual-inner {
        padding: clamp(30px, 4vw, 50px);
    }

    .visual-message h1 {
        font-size: clamp(2.25rem, 4.25vw, 3.55rem);
    }

    .portal-capabilities {
        grid-template-columns: 1fr;
        gap: 9px;
    }

    .portal-capabilities li {
        display: grid;
        grid-template-columns: 28px 1fr;
        gap: 11px;
        padding: 11px 13px;
    }

    .capability-check {
        margin: 0;
    }
}

@media (max-width: 800px) {
    .portal-layout {
        display: block;
    }

    .visual-panel {
        position: relative;
        min-height: clamp(240px, 32svh, 300px);
        background-image:
            linear-gradient(110deg, rgba(5, 11, 19, 0.9) 0%, rgba(7, 15, 25, 0.66) 70%, rgba(8, 18, 29, 0.43) 100%),
            linear-gradient(0deg, rgba(3, 8, 14, 0.28), rgba(3, 8, 14, 0.04)),
            var(--portal-image);
    }

    body.portal-gov-buyer {
        --portal-position: 52% center;
    }

    body.portal-supplier-mfg {
        --portal-position: 50% 55%;
    }

    body.portal-team {
        --portal-position: 54% 44%;
    }

    .visual-panel::after {
        right: -120px;
        bottom: 16%;
        width: 330px;
    }

    .visual-inner {
        min-height: clamp(240px, 32svh, 300px);
        padding: 22px clamp(20px, 5vw, 34px) 25px;
    }

    .brand-mark {
        width: 180px;
        padding: 8px 11px 7px;
        border-radius: 8px;
    }

    .visual-message {
        margin: auto 0 0;
        padding-top: 26px;
    }

    .visual-eyebrow {
        font-size: 0.64rem;
    }

    .visual-eyebrow::before {
        width: 28px;
    }

    .visual-message h1 {
        max-width: 560px;
        margin-top: 10px;
        font-size: clamp(1.75rem, 7vw, 2.55rem);
        line-height: 1.06;
    }

    .visual-summary,
    .portal-capabilities,
    .visual-disclaimer {
        display: none;
    }

    .auth-panel {
        min-height: auto;
        padding: 38px clamp(20px, 7vw, 54px) 42px;
    }

    .auth-inner {
        width: min(100%, 520px);
        padding: 0;
    }
}

@media (max-width: 420px) {
    .visual-panel,
    .visual-inner {
        min-height: 232px;
    }

    .visual-inner {
        padding: 18px 18px 21px;
    }

    .brand-mark {
        width: 164px;
    }

    .portal-topbar {
        gap: 8px;
    }

    .portal-topbar .brand-mark {
        width: clamp(132px, 41vw, 164px);
        flex-basis: auto;
    }

    .portal-topbar-actions {
        gap: 7px;
    }

    .secure-portal-label {
        gap: 5px;
        font-size: 0.56rem;
        letter-spacing: 0.07em;
    }

    .secure-portal-label svg {
        width: 14px;
        height: 14px;
    }

    .back-to-site {
        min-height: 40px;
        gap: 5px;
        padding: 7px 8px;
        font-size: 0.68rem;
    }

    .back-to-site svg {
        width: 14px;
        height: 14px;
    }

    .visual-message h1 {
        max-width: 340px;
        font-size: clamp(1.6rem, 7.6vw, 2rem);
    }

    .auth-panel {
        padding: 30px 16px 34px;
    }

    .portal-switcher {
        gap: 3px;
        margin-bottom: 29px;
        padding: 4px;
    }

    .portal-option {
        min-height: 44px;
        padding: 7px 5px;
        font-size: 0.69rem;
    }

    .auth-header h2 {
        font-size: 1.95rem;
    }

    .auth-header p {
        font-size: 0.92rem;
    }
}

@media (max-width: 340px) {
    .portal-topbar .brand-mark {
        width: 132px;
    }

    .back-to-site {
        gap: 4px;
        padding-inline: 7px;
    }

    .back-to-site svg {
        display: none;
    }

    .portal-option {
        font-size: 0.64rem;
        letter-spacing: -0.01em;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
