@font-face {
    font-family: "Rubik";
    src:
        url("../vendor/fonts/rubik/Rubik-Variable.068de81f6263.ttf")
        format("truetype");
    font-style: normal;
    font-weight: 300 900;
    font-display: swap;
}


:root {
    --purple: #5d27a1;
    --purple-dark: #472078;
    --purple-soft: #f1e8fb;

    --yellow: #fae265;
    --yellow-soft: #fff9d7;

    --text: #2f2b35;
    --muted: #77717f;

    --surface: #ffffff;
    --canvas: #f7f6f9;
    --line: #e8e4eb;

    --danger: #c83f63;
    --success: #397d5b;
    --info: #315ea8;

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

    --shadow:
        0 14px 40px rgba(50, 31, 68, 0.12);

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

    color: var(--text);
    background: var(--canvas);
}


* {
    box-sizing: border-box;
}


html,
body {
    margin: 0;
    min-width: 320px;
    min-height: 100%;
}


body {
    background: var(--canvas);
    color: var(--text);
}


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


button {
    cursor: pointer;
}


a {
    color: inherit;
}


/* =========================================================
   APP SHELL
   ========================================================= */


.app-shell {
    min-height: 100vh;

    display: grid;

    grid-template-columns:
        252px
        minmax(0, 1fr);
}


.sidebar {
    position: sticky;
    top: 0;
    z-index: 40;

    height: 100vh;

    display: flex;
    flex-direction: column;

    padding: 22px 16px 16px;

    border-right: 1px solid var(--line);

    background: var(--surface);
}


.app-main {
    min-width: 0;

    padding:
        28px
        30px
        42px;
}


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


.sidebar-brand {
    display: flex;
    align-items: center;

    gap: 16px;

    padding:
        8px
        12px
        24px;

    text-decoration: none;
}


.sidebar-logo {
    display: block;

    width: 48px;
    height: 48px;

    flex: 0 0 48px;

    object-fit: contain;
}


.sidebar-brand-name {
    color: #252b3b;

    font-size: 27px;
    font-weight: 700;

    line-height: 1;

    letter-spacing: 0.02em;
}



/* =========================================================
   ROLE PLACEHOLDER
   ========================================================= */


.role-box {
    padding: 12px;

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

    background: var(--purple-soft);
}


.role-box-label {
    display: block;

    margin-bottom: 6px;

    color: #6f6477;

    font-size: 11px;
    font-weight: 700;

    letter-spacing: 0.07em;

    text-transform: uppercase;
}


.role-box-value {
    color: var(--purple-dark);

    font-size: 14px;
    font-weight: 700;
}

.role-switch-form {
    margin: 0;
}


.role-select {
    width: 100%;

    padding:
        4px
        30px
        4px
        4px;

    border: 0;

    background: transparent;

    color: var(--purple-dark);

    font-size: 15px;
    font-weight: 700;

    cursor: pointer;

    outline: none;
}


.role-select:focus {
    border: 0;

    box-shadow: none;
}


/* =========================================================
   NAVIGATION
   ========================================================= */


.sidebar-nav {
    display: grid;

    gap: 5px;

    margin-top: 18px;
}


.sidebar-nav-section {
    margin:
        16px
        12px
        5px;

    color: #aaa4ae;

    font-size: 10px;
    font-weight: 700;

    letter-spacing: 0.08em;

    text-transform: uppercase;
}


.nav-link {
    min-height: 44px;

    display: flex;
    align-items: center;

    gap: 11px;

    padding:
        10px
        12px;

    border-radius: 11px;

    color: #5a545e;

    font-size: 14px;
    font-weight: 500;

    text-decoration: none;

    transition:
        background 0.12s,
        color 0.12s;
}

.nav-link:hover {
    background: #f5f2f7;
}


.nav-link.is-active {
    background: var(--purple);
    color: white;
}


.nav-icon {
    width: 22px;

    flex: 0 0 22px;

    text-align: center;

    font-size: 17px;
}

.nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-width: 20px;
    height: 20px;

    margin-left: auto;
    padding: 0 6px;

    border-radius: 999px;

    background: var(--yellow);
    color: var(--purple-dark);

    font-size: 10px;
    font-weight: 700;

    line-height: 1;
}


.nav-link.is-active .nav-badge {
    background: var(--yellow);
    color: var(--purple-dark);
}


/* =========================================================
   SIDEBAR FOOTER
   ========================================================= */


.sidebar-footer {
    margin-top: auto;

    display: grid;

    gap: 8px;
}


.profile-card {
    display: flex;
    align-items: center;

    gap: 10px;

    padding: 10px;

    border-radius: 12px;

    text-decoration: none;
}


.profile-card:hover {
    background: #f5f2f7;
}


.avatar {
    width: 38px;
    height: 38px;

    flex: 0 0 38px;

    display: grid;
    place-items: center;

    border-radius: 50%;

    background: var(--yellow);
    color: var(--purple-dark);

    font-size: 13px;
    font-weight: 700;

    letter-spacing: -0.02em;
}


.profile-copy {
    min-width: 0;
}


.profile-copy strong,
.profile-copy span {
    display: block;
}


.profile-copy strong {
    overflow: hidden;

    font-size: 13px;

    text-overflow: ellipsis;
    white-space: nowrap;
}


.profile-copy span {
    margin-top: 2px;

    color: var(--muted);

    font-size: 11px;
}


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


.page-header {
    display: flex;

    align-items: flex-start;
    justify-content: space-between;

    gap: 24px;

    margin-bottom: 22px;
}


.page-header h1 {
    margin: 0;

    font-size: 30px;
    line-height: 1.2;
}


.page-header p {
    margin:
        7px
        0
        0;

    color: var(--muted);
}


.header-actions {
    display: flex;

    align-items: center;

    gap: 10px;
}


/* =========================================================
   COMMON COMPONENTS
   ========================================================= */


.panel {
    border: 1px solid var(--line);

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

    background: var(--surface);

    box-shadow:
        0 2px 8px rgba(40, 30, 50, 0.025);
}


.btn {
    min-height: 42px;

    padding:
        10px
        16px;

    border: 0;
    border-radius: var(--radius-sm);

    background: #eeeaf1;
    color: var(--text);

    font-weight: 600;

    text-decoration: none;

    transition:
        transform 0.12s,
        background 0.12s;
}


.btn:hover {
    transform: translateY(-1px);
}


.btn-primary {
    background: var(--purple);
    color: white;
}


.btn-primary:hover {
    background: var(--purple-dark);
}


.btn-secondary {
    background: var(--yellow);
    color: #3d3314;
}


.btn-outline {
    border: 1px solid var(--line);

    background: white;
}


.btn-danger {
    background: #fae7ec;
    color: #9f2f50;
}


.input,
.select,
.textarea,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
select,
textarea {
    width: 100%;

    padding:
        13px
        14px;

    border:
        1px
        solid
        #d9d4de;

    border-radius: var(--radius-sm);

    outline: none;

    background: var(--surface);
    color: var(--text);
}


input:focus,
select:focus,
textarea:focus {
    border-color: var(--purple);

    box-shadow:
        0
        0
        0
        3px
        rgba(93, 39, 161, 0.12);
}


/* =========================================================
   DJANGO MESSAGES
   ========================================================= */


.messages {
    display: grid;

    gap: 8px;

    margin-bottom: 18px;
}


.message {
    padding:
        12px
        14px;

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

    border-radius: var(--radius-sm);

    background: white;

    font-size: 14px;
}


.message.success {
    border-color: #b7ddc8;

    background: #eff9f3;

    color: #286746;
}


.message.error {
    border-color: #efc0cc;

    background: #fff1f4;

    color: #97334f;
}


.message.warning {
    border-color: #f0df85;

    background: var(--yellow-soft);

    color: #66561f;
}


/* =========================================================
   MOBILE HEADER
   ========================================================= */


.mobile-header {
    display: none;
}


.mobile-menu-button {
    width: 42px;
    height: 42px;

    display: grid;
    place-items: center;

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

    border-radius: 10px;

    background: white;

    font-size: 21px;
}


.sidebar-overlay {
    display: none;
}

/* =========================================================
   LOGIN
   ========================================================= */


.login-screen {
    min-height: 100vh;

    display: grid;

    grid-template-columns:
        minmax(340px, 1fr)
        minmax(420px, 0.82fr);

    background: var(--surface);
}


.login-brand {
    position: relative;

    overflow: hidden;

    display: flex;
    flex-direction: column;
    justify-content: space-between;

    padding:
        clamp(32px, 6vw, 84px);

    background:
        radial-gradient(
            circle at 78% 22%,
            rgba(255, 255, 255, 0.68) 0 5%,
            transparent 5.3%
        ),
        linear-gradient(
            145deg,
            var(--yellow) 0%,
            #fff3a6 48%,
            #ead9f9 100%
        );
}


.login-brand::after {
    content: "";

    position: absolute;

    width: 360px;
    height: 360px;

    right: -120px;
    bottom: -140px;

    border-radius: 50%;

    background:
        rgba(93, 39, 161, 0.12);
}


.login-brand-logo {
    position: relative;
    z-index: 1;
}


.login-logo {
    display: block;

    width: min(390px, 88%);
    height: auto;
}


.login-message {
    position: relative;
    z-index: 1;

    max-width: 620px;
}


.login-message h1 {
    margin:
        0
        0
        18px;

    color: var(--purple);

    font-size:
        clamp(34px, 5vw, 66px);

    line-height: 1.02;
}


.login-message p {
    max-width: 520px;

    margin: 0;

    color: #584c60;

    font-size: 18px;

    line-height: 1.55;
}


.login-form-wrap {
    display: grid;
    place-items: center;

    padding: 36px;
}


.login-form {
    width: min(
        420px,
        100%
    );
}


.login-eyebrow {
    margin:
        0
        0
        10px;

    color: var(--purple);

    font-size: 13px;
    font-weight: 700;

    letter-spacing: 0.08em;

    text-transform: uppercase;
}


.login-form h2 {
    margin:
        0
        0
        10px;

    font-size: 34px;
}


.login-description {
    margin:
        0
        0
        32px;

    color: var(--muted);

    line-height: 1.5;
}


.login-field {
    display: grid;

    gap: 8px;

    margin-bottom: 18px;
}


.login-field label {
    font-size: 14px;
    font-weight: 600;
}


.login-field input {
    width: 100%;

    padding:
        13px
        14px;

    border:
        1px solid
        #d9d4de;

    border-radius:
        var(--radius-sm);

    background:
        var(--surface);

    color:
        var(--text);

    outline: none;

    transition:
        border-color 0.15s,
        box-shadow 0.15s;
}


.login-field input:focus {
    border-color:
        var(--purple);

    box-shadow:
        0 0 0 3px
        rgba(93, 39, 161, 0.12);
}


.login-submit {
    width: 100%;

    margin-top: 2px;
}


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

    padding:
        12px
        14px;

    border-radius:
        var(--radius-sm);

    background:
        #fae7ec;

    color:
        #9f2f50;

    font-size: 13px;

    line-height: 1.45;
}


.auth-messages {
    position: fixed;

    z-index: 100;

    top: 18px;
    right: 18px;

    width: min(
        400px,
        calc(100vw - 36px)
    );
}

/* =========================================================
   AUTH FALLBACK
   ========================================================= */


.auth-page {
    min-height: 100vh;

    display: grid;
    place-items: center;

    padding: 30px;

    background: var(--canvas);
}


.auth-page-inner {
    width: min(430px, 100%);

    padding: 36px;

    border: 1px solid var(--line);
    border-radius: var(--radius-lg);

    background: var(--surface);

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

.auth-card {
    width: 100%;
}


.auth-brand {
    display: flex;
    align-items: center;
    justify-content: center;

    gap: 12px;

    margin-bottom: 30px;
}


.auth-logo {
    width: 52px;
    height: 52px;

    object-fit: contain;
}


.auth-brand-name {
    color: var(--text);

    font-size: 29px;
    font-weight: 700;

    letter-spacing: 0.01em;
}


.auth-heading {
    margin-bottom: 24px;

    text-align: center;
}


.auth-heading h1 {
    margin: 0;

    font-size: 28px;
    font-weight: 700;
}


.auth-heading p {
    margin: 8px 0 0;

    color: var(--muted);

    font-size: 13px;
}


.auth-form {
    display: grid;

    gap: 16px;
}


.auth-field {
    display: grid;

    gap: 7px;
}


.auth-field > span {
    color: var(--muted);

    font-size: 11px;
    font-weight: 600;
}


.auth-field input {
    width: 100%;

    padding: 12px 13px;

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

    border-radius: 10px;

    background: var(--surface);

    color: var(--text);

    outline: none;

    transition:
        border-color 0.12s,
        box-shadow 0.12s;
}


.auth-field input:focus {
    border-color: var(--purple);

    box-shadow:
        0 0 0 3px
        rgba(93, 39, 161, 0.08);
}


.auth-submit {
    width: 100%;

    min-height: 44px;

    margin-top: 4px;
}


.auth-error {
    margin-bottom: 16px;

    padding: 11px 12px;

    border-radius: 10px;

    background:
        rgba(200, 63, 99, 0.08);

    color: var(--danger);

    font-size: 12px;
    line-height: 1.4;
}

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


@media (max-width: 1080px) {

    .app-main {
        padding:
            24px
            22px
            36px;
    }

}


@media (max-width: 780px) {

    .app-shell {
        display: block;
    }


    .sidebar {
        position: fixed;

        top: 0;
        left: 0;

        width: min(300px, 86vw);

        transform: translateX(-105%);

        transition: transform 0.2s ease;

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


    .sidebar.is-open {
        transform: translateX(0);
    }


    .sidebar-overlay {
        position: fixed;

        inset: 0;

        z-index: 30;

        display: block;

        visibility: hidden;

        background:
            rgba(32, 25, 38, 0.35);

        opacity: 0;

        transition:
            opacity 0.2s,
            visibility 0.2s;
    }


    .sidebar-overlay.is-open {
        visibility: visible;

        opacity: 1;
    }


    .mobile-header {
        position: sticky;

        top: 0;

        z-index: 25;

        display: flex;

        align-items: center;
        justify-content: space-between;

        gap: 12px;

        padding:
            10px
            14px;

        border-bottom:
            1px
            solid
            var(--line);

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

        backdrop-filter: blur(10px);
    }


    .mobile-brand {
        font-weight: 700;
        color: var(--purple);
    }


    .app-main {
        padding:
            20px
            14px
            32px;
    }


    .page-header {
        gap: 14px;

        margin-bottom: 18px;
    }


    .page-header h1 {
        font-size: 25px;
    }

    .login-screen {
        grid-template-columns: 1fr;
    }


    .login-brand {
        min-height: 280px;

        padding: 28px;
    }


    .login-logo {
        width: min(300px, 86%);
    }


    .login-message h1 {
        font-size: 36px;
    }


    .login-message p {
        font-size: 15px;
    }


    .login-form-wrap {
        padding:
            30px
            22px
            44px;
    }

}


@media (max-width: 520px) {

    .page-header {
        display: grid;
    }


    .header-actions {
        flex-wrap: wrap;
    }


    .auth-page {
        padding: 16px;
    }


    .auth-page-inner {
        padding: 22px;

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

    .login-brand {
        min-height: 240px;
    }


    .login-message p {
        display: none;
    }

}

.sidebar-logout-form {
    margin: 0;
}


.sidebar-logout-button {
    width: 100%;

    border: 0;

    font: inherit;

    text-align: left;

    cursor: pointer;
}