/* ================================================================================
app/portal/static/css/portal.css
================================================================================ */


/* ======================================================
DESIGN TOKENS
====================================================== */

:root {
    --scfn-bg: #f5f7fb;

    --scfn-surface: #ffffff;
    --scfn-surface-glass: rgba(255, 255, 255, 0.82);

    --scfn-navy: #0b2f5f;
    --scfn-navy-dark: #08254b;

    --scfn-blue: #1457a8;
    --scfn-blue-strong: #0b4a91;
    --scfn-blue-soft: #e8f1ff;

    --scfn-text: #111827;
    --scfn-muted: #6b7280;

    --scfn-border: #e2e8f0;

    --scfn-success: #16a34a;
    --scfn-warning: #d97706;
    --scfn-danger: #dc2626;

    --scfn-topbar-height: 72px;

    --scfn-radius-sm: 10px;
    --scfn-radius-md: 16px;
    --scfn-radius-lg: 24px;

    --scfn-shadow:
        0 16px 42px
        rgba(15, 23, 42, 0.07);

    --scfn-shadow-hover:
        0 28px 60px
        rgba(15, 23, 42, 0.13);
}


/* ======================================================
RESET
====================================================== */

* {
    box-sizing: border-box;
}


html {
    min-height: 100%;
}


body {
    margin: 0;

    min-width: 320px;
    min-height: 100vh;

    color:
        var(--scfn-text);

    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    background:
        radial-gradient(
            circle at 86% 0,
            rgba(20, 87, 168, 0.10),
            transparent 28%
        ),
        var(--scfn-bg);
}


a {
    color: inherit;

    text-decoration: none;
}


button,
input,
select,
textarea {
    font: inherit;
}


/* ======================================================
PORTAL SHELL
====================================================== */

.scfn-shell {
    min-height: 100vh;
}


.scfn-portal-content {
    min-height:
        calc(
            100vh
            - var(--scfn-topbar-height)
        );
}


/* ======================================================
GLOBAL TOPBAR
====================================================== */

.scfn-topbar {
    position: sticky;

    top: 0;

    z-index: 1000;

    height:
        var(--scfn-topbar-height);

    padding:
        0
        clamp(20px, 4vw, 60px);

    display: flex;

    align-items: center;

    justify-content: space-between;

    gap: 24px;

    border-bottom:
        1px solid
        rgba(226, 232, 240, 0.88);

    background:
        var(--scfn-surface-glass);

    backdrop-filter:
        blur(20px)
        saturate(160%);

    -webkit-backdrop-filter:
        blur(20px)
        saturate(160%);
}


.scfn-topbar-left {
    min-width: 0;

    display: flex;

    align-items: center;

    gap: 18px;
}


/* ======================================================
BRAND
====================================================== */

.scfn-brand {
    flex-shrink: 0;

    display: flex;

    align-items: center;

    gap: 12px;
}


.scfn-brand-mark {
    width: 42px;

    height: 42px;

    display: flex;

    align-items: center;

    justify-content: center;

    border-radius: 14px;

    color: #ffffff;

    background:
        linear-gradient(
            145deg,
            var(--scfn-blue),
            var(--scfn-navy-dark)
        );

    font-size: 15px;

    font-weight: 900;

    letter-spacing: -0.04em;

    box-shadow:
        0 10px 24px
        rgba(11, 47, 95, 0.22);

    transition:
        transform 0.22s ease,
        box-shadow 0.22s ease;
}


.scfn-brand:hover
.scfn-brand-mark {
    transform:
        scale(1.04);

    box-shadow:
        0 13px 28px
        rgba(11, 47, 95, 0.27);
}


.scfn-brand-name {
    color:
        var(--scfn-navy);

    font-size: 15px;

    font-weight: 800;

    white-space: nowrap;
}


/* ======================================================
PORTAL CONTEXT
====================================================== */

.scfn-context {
    min-width: 0;

    display: flex;

    align-items: center;

    gap: 13px;
}


.scfn-context-divider {
    width: 1px;

    height: 25px;

    flex:
        0 0 1px;

    background:
        var(--scfn-border);
}


.scfn-context-name {
    overflow: hidden;

    color:
        var(--scfn-muted);

    font-size: 13px;

    font-weight: 700;

    text-overflow: ellipsis;

    white-space: nowrap;
}


/* ======================================================
PROFILE
====================================================== */

.scfn-profile {
    position: relative;

    flex-shrink: 0;
}


.scfn-profile-button {
    min-height: 44px;

    padding:
        6px
        10px
        6px
        8px;

    display: flex;

    align-items: center;

    gap: 9px;

    border:
        1px solid
        transparent;

    border-radius: 12px;

    color:
        var(--scfn-text);

    background:
        transparent;

    cursor: pointer;

    transition:
        border-color 0.20s ease,
        background 0.20s ease;
}


.scfn-profile-button:hover,
.scfn-profile.is-open
.scfn-profile-button {
    border-color:
        var(--scfn-border);

    background:
        #f8fafc;
}


.scfn-profile-user-icon {
    width: 34px;

    height: 34px;

    flex:
        0 0 34px;

    display: flex;

    align-items: center;

    justify-content: center;

    border-radius: 10px;

    color:
        var(--scfn-navy);

    background:
        var(--scfn-blue-soft);
}


.scfn-profile-user-icon svg {
    width: 18px;

    height: 18px;

    fill: none;

    stroke:
        currentColor;

    stroke-width: 1.8;

    stroke-linecap: round;

    stroke-linejoin: round;
}


.scfn-profile-summary {
    min-width: 0;

    display: flex;

    align-items: center;
}


.scfn-profile-summary strong {
    max-width: 160px;

    overflow: hidden;

    color:
        var(--scfn-navy-dark);

    font-size: 13px;

    font-weight: 700;

    text-overflow: ellipsis;

    white-space: nowrap;
}


.scfn-profile-chevron {
    width: 18px;

    height: 18px;

    display: flex;

    align-items: center;

    justify-content: center;

    color:
        var(--scfn-muted);

    transition:
        transform 0.20s ease;
}


.scfn-profile-chevron svg {
    width: 15px;

    height: 15px;

    fill: none;

    stroke:
        currentColor;

    stroke-width: 2;

    stroke-linecap: round;

    stroke-linejoin: round;
}


.scfn-profile.is-open
.scfn-profile-chevron {
    transform:
        rotate(180deg);
}


/* ======================================================
PROFILE MENU
====================================================== */

.scfn-profile-menu {
    position: absolute;

    top:
        calc(100% + 10px);

    right: 0;

    z-index: 1100;

    width: 300px;

    padding: 8px;

    opacity: 0;

    visibility: hidden;

    transform:
        translateY(-6px);

    border:
        1px solid
        var(--scfn-border);

    border-radius:
        var(--scfn-radius-md);

    background:
        rgba(255, 255, 255, 0.97);

    box-shadow:
        0 22px 55px
        rgba(15, 23, 42, 0.14);

    backdrop-filter:
        blur(20px);

    -webkit-backdrop-filter:
        blur(20px);

    transition:
        opacity 0.20s ease,
        visibility 0.20s ease,
        transform 0.20s ease;
}


.scfn-profile.is-open
.scfn-profile-menu {
    opacity: 1;

    visibility: visible;

    transform:
        translateY(0);
}


.scfn-profile-info {
    padding:
        14px
        14px
        13px;

    display: flex;

    flex-direction: column;

    align-items: flex-start;
}


.scfn-profile-info strong {
    color:
        var(--scfn-navy-dark);

    font-size: 14px;

    font-weight: 800;

    line-height: 1.4;
}


.scfn-profile-email {
    max-width: 100%;

    margin-top: 3px;

    overflow: hidden;

    color:
        var(--scfn-muted);

    font-size: 12px;

    text-overflow: ellipsis;

    white-space: nowrap;
}


.scfn-profile-role {
    margin-top: 10px;

    padding:
        5px
        9px;

    display: inline-flex;

    border-radius: 999px;

    color:
        var(--scfn-blue);

    background:
        var(--scfn-blue-soft);

    font-size: 10px;

    font-weight: 800;

    letter-spacing: 0.04em;
}


.scfn-profile-menu-divider {
    height: 1px;

    margin:
        2px
        6px
        6px;

    background:
        var(--scfn-border);
}


.scfn-profile-menu form {
    margin: 0;
}


.scfn-profile-action {
    width: 100%;

    min-height: 42px;

    padding:
        10px
        12px;

    display: flex;

    align-items: center;

    gap: 10px;

    border: 0;

    border-radius: 10px;

    color:
        #344054;

    background:
        transparent;

    font-size: 12px;

    font-weight: 700;

    text-align: left;

    cursor: pointer;

    transition:
        color 0.20s ease,
        background 0.20s ease;
}


.scfn-profile-action svg {
    width: 18px;

    height: 18px;

    flex:
        0 0 18px;

    fill: none;

    stroke:
        currentColor;

    stroke-width: 1.8;

    stroke-linecap: round;

    stroke-linejoin: round;
}


.scfn-profile-action:hover {
    color:
        var(--scfn-blue);

    background:
        var(--scfn-blue-soft);
}


.scfn-profile-logout:hover {
    color:
        var(--scfn-danger);

    background:
        #fff1f2;
}


/* ======================================================
SHARED PAGE CONTAINER
====================================================== */

.scfn-page-container {
    width:
        min(
            1280px,
            calc(100% - 40px)
        );

    margin:
        0
        auto;

    padding:
        40px
        0
        60px;
}


/* ======================================================
SHARED PAGE HEADER
====================================================== */

.scfn-page-header {
    margin-bottom: 26px;

    display: flex;

    align-items: flex-end;

    justify-content: space-between;

    gap: 24px;
}


.scfn-page-header-copy {
    min-width: 0;
}


.scfn-page-eyebrow {
    display: block;

    margin-bottom: 7px;

    color:
        var(--scfn-blue);

    font-size: 10px;

    font-weight: 800;

    letter-spacing: 0.12em;

    text-transform: uppercase;
}


.scfn-page-header h1 {
    margin: 0;

    color:
        var(--scfn-navy-dark);

    font-size:
        clamp(
            27px,
            3vw,
            39px
        );

    font-weight: 800;

    letter-spacing: -0.04em;
}


.scfn-page-header p {
    margin:
        8px
        0
        0;

    color:
        var(--scfn-muted);

    font-size: 14px;

    line-height: 1.6;
}


/* ======================================================
SHARED CARD
====================================================== */

.scfn-card {
    border:
        1px solid
        var(--scfn-border);

    border-radius:
        var(--scfn-radius-md);

    background:
        var(--scfn-surface);

    box-shadow:
        var(--scfn-shadow);
}


/* ======================================================
SHARED ACTIONS
====================================================== */

.scfn-primary-action,
.scfn-secondary-action {
    min-height: 40px;

    padding:
        10px
        16px;

    display: inline-flex;

    align-items: center;

    justify-content: center;

    gap: 8px;

    border-radius: 10px;

    font-size: 13px;

    font-weight: 700;

    cursor: pointer;

    transition:
        transform 0.20s ease,
        box-shadow 0.20s ease,
        background 0.20s ease,
        border-color 0.20s ease;
}


.scfn-primary-action {
    border:
        1px solid
        var(--scfn-navy);

    color: #ffffff;

    background:
        var(--scfn-navy);
}


.scfn-primary-action:hover {
    transform:
        translateY(-1px);

    border-color:
        var(--scfn-blue-strong);

    background:
        var(--scfn-blue-strong);

    box-shadow:
        0 9px 22px
        rgba(11, 47, 95, 0.18);
}


.scfn-secondary-action {
    border:
        1px solid
        var(--scfn-border);

    color:
        #344054;

    background:
        #ffffff;
}


.scfn-secondary-action:hover {
    transform:
        translateY(-1px);

    border-color:
        #cbd5e1;

    background:
        #f8fafc;
}


/* ======================================================
FORM BASE
====================================================== */

.scfn-field {
    margin-bottom: 18px;
}


.scfn-field label {
    display: block;

    margin-bottom: 7px;

    color:
        #344054;

    font-size: 13px;

    font-weight: 700;
}


.scfn-field input,
.scfn-field select,
.scfn-field textarea {
    width: 100%;

    padding:
        11px
        13px;

    border:
        1px solid
        #cfd6df;

    border-radius: 9px;

    color:
        var(--scfn-text);

    background:
        #ffffff;

    font-size: 14px;

    outline: none;

    transition:
        border-color 0.20s ease,
        box-shadow 0.20s ease;
}


.scfn-field input:focus,
.scfn-field select:focus,
.scfn-field textarea:focus {
    border-color:
        var(--scfn-blue);

    box-shadow:
        0 0 0 3px
        rgba(20, 87, 168, 0.12);
}


/* ======================================================
FEEDBACK
====================================================== */

.scfn-error {
    margin-bottom: 18px;

    padding:
        12px
        14px;

    border:
        1px solid
        #fecaca;

    border-radius: 10px;

    color:
        #991b1b;

    background:
        #fff7f7;

    font-size: 13px;
}


.scfn-empty {
    padding: 48px;

    color:
        var(--scfn-muted);

    text-align: center;
}


/* ======================================================
GLOBAL TOAST
====================================================== */

.scfn-toast {
    position: fixed;

    top:
        calc(
            var(--scfn-topbar-height)
            + 22px
        );

    right: 24px;

    z-index: 2000;

    width:
        min(
            420px,
            calc(100% - 32px)
        );

    min-height: 92px;

    padding:
        18px
        46px
        18px
        18px;

    display: flex;

    align-items: flex-start;

    gap: 14px;

    overflow: hidden;

    opacity: 0;

    border:
        1px solid
        var(--scfn-border);

    border-radius:
        var(--scfn-radius-md);

    background:
        rgba(255, 255, 255, 0.96);

    box-shadow:
        0 24px 60px
        rgba(15, 23, 42, 0.18);

    backdrop-filter:
        blur(14px);

    -webkit-backdrop-filter:
        blur(14px);

    transform:
        translateX(32px);

    transition:
        opacity 0.30s ease,
        transform 0.30s ease;
}


.scfn-toast.is-visible {
    opacity: 1;

    transform:
        translateX(0);
}


.scfn-toast.is-leaving {
    opacity: 0;

    transform:
        translateX(32px);
}


.scfn-toast-icon {
    width: 42px;

    height: 42px;

    flex:
        0 0 42px;

    display: flex;

    align-items: center;

    justify-content: center;

    border-radius: 12px;
}


.scfn-toast-icon svg {
    width: 22px;

    height: 22px;
}


.scfn-toast-warning
.scfn-toast-icon {
    color:
        var(--scfn-warning);

    background:
        #fff7ed;
}


.scfn-toast-content {
    min-width: 0;

    padding-top: 2px;

    display: flex;

    flex-direction: column;

    gap: 5px;
}


.scfn-toast-content strong {
    color:
        var(--scfn-navy-dark);

    font-size: 14px;

    font-weight: 800;
}


.scfn-toast-content span {
    color:
        var(--scfn-muted);

    font-size: 12px;

    line-height: 1.55;
}


.scfn-toast-close {
    position: absolute;

    top: 13px;

    right: 13px;

    width: 28px;

    height: 28px;

    padding: 0;

    display: flex;

    align-items: center;

    justify-content: center;

    border: 0;

    border-radius: 8px;

    color:
        var(--scfn-muted);

    background:
        transparent;

    cursor: pointer;

    transition:
        color 0.20s ease,
        background 0.20s ease;
}


.scfn-toast-close:hover {
    color:
        var(--scfn-text);

    background:
        #f1f5f9;
}


.scfn-toast-close svg {
    width: 16px;

    height: 16px;
}


.scfn-toast-progress {
    position: absolute;

    left: 0;

    bottom: 0;

    width: 100%;

    height: 3px;

    background:
        var(--scfn-warning);

    transform-origin:
        left center;
}


.scfn-toast.is-running
.scfn-toast-progress {
    animation:
        scfn-toast-progress
        10s
        linear
        forwards;
}


@keyframes scfn-toast-progress {

    from {
        transform:
            scaleX(1);
    }

    to {
        transform:
            scaleX(0);
    }

}


/* ======================================================
RESPONSIVE
====================================================== */

@media (max-width: 700px) {

    .scfn-topbar {
        padding:
            0
            16px;
    }


    .scfn-brand-name {
        font-size: 14px;
    }


    .scfn-context-divider,
    .scfn-context-name {
        display: none;
    }


    .scfn-page-container {
        width:
            calc(100% - 30px);

        padding-top: 30px;
    }


    .scfn-page-header {
        align-items: flex-start;

        flex-direction: column;
    }

}


@media (max-width: 620px) {

    .scfn-profile-summary,
    .scfn-profile-chevron {
        display: none;
    }


    .scfn-profile-button {
        padding: 5px;
    }


    .scfn-profile-menu {
        width:
            min(
                300px,
                calc(100vw - 32px)
            );
    }


    .scfn-toast {
        top:
            calc(
                var(--scfn-topbar-height)
                + 14px
            );

        right: 16px;

        left: 16px;

        width: auto;
    }

}