@import url('https://fonts.googleapis.com/css2?family=Barlow:wght@400;500;600;700&family=Montserrat:wght@400;500;600;700&display=swap');

:root {
    --font-sans: "Barlow", "Helvetica Neue", Helvetica, Arial, sans-serif;
    --font-secondary: "Montserrat", "Helvetica Neue", Helvetica, Arial, sans-serif;
    --color-text: #252525;
    --color-muted: #777777;
    --primary-reset: #e00000;
    --primary-reset-dark: #bb0000;
    --color-accent: var(--primary-reset);
    --color-accent-dark: var(--primary-reset-dark);
    --color-surface: #ffffff;
    --color-border: rgba(22, 22, 22, 0.05);
    --shadow-soft: 0 18px 42px rgba(22, 22, 22, 0.06);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-family: var(--font-sans);
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: inherit;
    color: var(--color-text);
}

.toast-stack {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 50000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: min(92vw, 360px);
    pointer-events: none;
}

.toast {
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 18px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.96);
    color: #202020;
    border: 1px solid rgba(18, 18, 18, 0.08);
    box-shadow: 0 18px 34px rgba(0, 0, 0, 0.12);
    transform: translateY(-8px);
    opacity: 0;
    transition: opacity 0.18s ease, transform 0.18s ease;
    pointer-events: auto;
    overflow: hidden;
    --toast-accent: #e00000;
}

.toast.is-visible {
    transform: translateY(0);
    opacity: 1;
}

.toast.is-leaving {
    transform: translateY(-8px);
    opacity: 0;
}

.toast-success {
    --toast-accent: #e00000;
}

.toast-error {
    --toast-accent: #e00000;
}

.toast-message {
    padding-right: 20px;
    font-size: 15px;
    line-height: 1.45;
}

.toast-close {
    border: 0;
    background: transparent;
    color: #6b6b6b;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}

.toast-progress {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 4px;
    background: rgba(17, 17, 17, 0.08);
}

.toast-progress::after {
    content: "";
    position: absolute;
    inset: 0;
    transform-origin: left center;
    background: var(--toast-accent);
    animation: toast-progress-shrink 4s linear forwards;
}

@keyframes toast-progress-shrink {
    from {
        transform: scaleX(1);
    }

    to {
        transform: scaleX(0);
    }
}

body,
button,
input,
select,
textarea,
a,
h1,
h2,
h3,
h4,
h5,
h6,
p,
span,
label,
li,
td,
th {
    font-family: inherit;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

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

.menu-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.primary-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 30000;
    width: 100%;
    max-width: none;
    padding: 18px 26px 16px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: start;
    gap: 16px;
}

.primary-header::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100vw;
    height: 100%;
    background: #f8f8f8;
    z-index: -1;
}

.primary-header-spacer {
    min-height: 1px;
}

.primary-header .profile {
    position: absolute;
    top: 18px;
    right: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
}

.nav-primary {
    margin-top: 6px;
}

.nav-primary a,
.nav-secondary a {
    padding: 0 25px;
    color: #cccccc;
    cursor: pointer !important;
    font-size: 22.65px;
    line-height: 1.2;
    text-shadow: none;
    box-shadow: none;
    filter: none;
    transition: color 0.18s ease;
}

.nav-primary a:hover,
.nav-primary a.active,
.nav-secondary a:hover,
.nav-secondary a.active {
    color: #000000 !important;
}

.nav .sep {
    color: #dddddd;
    font-size: 22.65px;
    line-height: 1;
}

.profile-menu {
    position: relative;
    display: inline-flex;
}

.profile-backdrop,
.profile-close,
.profile-mobile-nav {
    display: none;
}

.profile-trigger {
    border: 0;
    background: transparent;
    padding: 0;
    cursor: pointer;
    position: relative;
    z-index: 20000;
}

.avatar,
.academy-member-avatar {
    --academy-avatar-size: 60px;
    width: var(--academy-avatar-size);
    height: var(--academy-avatar-size);
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 18px;
    font-weight: 600;
    line-height: 1;
    box-shadow: 0 10px 24px rgba(224, 0, 0, 0.18);
    background: #e00000;
    border: 1.5px solid #e00000;
}

.avatar img,
.academy-member-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
    display: block;
}

.avatar {
    --academy-avatar-size: 54px;
}

.academy-member-avatar-violet,
.academy-member-avatar-sand,
.academy-member-avatar-stone,
.academy-member-avatar-slate,
.academy-member-avatar-gold {
    background: #e00000;
}

.profile-popover {
    position: absolute;
    top: -18px;
    right: -12px;
    z-index: 30;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-6px) scale(0.98);
    transform-origin: top right;
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
}

.profile-menu:hover .profile-popover,
.profile-menu:focus-within .profile-popover {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.profile-card {
    width: min(82vw, 300px);
    min-height: 200px;
    padding: 28px 38px 32px;
    margin-top: 14px;
    margin-right: 5px;
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 26px 60px rgba(24, 24, 24, 0.12);
}

.profile-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 24px;
    margin-bottom: 42px;
    padding-right: 62px;
}

.profile-card-head h2 {
    margin: 0 0 5px;
    font-size: 14px;
    line-height: 1.4;
    font-weight: 500;
}

.role-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 30px;
    padding: 0 7px;
    background: #ececec;
    color: #303030;
    font-family: "Barlow", var(--font-sans) !important;
    font-size: 14px !important;
    font-weight: 500;
}

.profile-card-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.profile-nav-link {
    display: block;
    color: #2a2a2a;
    font-size: 18px;
    font-weight: 500;
    line-height: 1.3;
    text-decoration: none;
}

.profile-nav-link.active {
    color: #000000;
}

.profile-action {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    line-height: 1.4;
    font-weight: 400;
    color: #141414;
}

.profile-action-icon {
    width: 40px;
    height: 40px;
    color: var(--primary-reset);
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.profile-action-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

.profile-action-icon img {
    width: 65%;
    height: auto;
    display: block;
    margin: auto;
}

body.settings-modal-open {
    overflow: hidden;
}

.settings-modal[hidden] {
    display: none;
}

.settings-modal {
    position: fixed;
    inset: 0;
    z-index: 31000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.settings-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.58);
}

.settings-modal-panel {
    position: relative;
    width: min(100%, 536px);
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    margin: 140px auto;
    border-radius: 20px;
    background: #ffffff;
    padding: 52px 42px 32px;
    box-shadow: 0 28px 80px rgba(17, 17, 17, 0.16);
}

.settings-modal-close {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 999px;
    background: #f2f2f2;
    color: #111111;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
}

.settings-modal-title {
    margin: 0 0 30px;
    text-align: center;
    font-size: 36.65px;
    line-height: 1.05;
    font-weight: 600;
    color: #000000;
}

.settings-modal-avatar {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

.settings-modal-avatar .avatar {
    --academy-avatar-size: 92px;
    font-size: 28px;
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.settings-field {
    display: flex;
    flex-direction: column;
}

.settings-field input {
    width: 100%;
    border: 1px solid transparent;
    border-radius: 20px;
    background: #f6f6f6;
    padding: 4.5% 3%;
    font-size: 14px;
    color: #101010;
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.settings-password-wrap {
    position: relative;
    width: 100%;
}

.settings-password-wrap input {
    padding-right: 48px;
}

.settings-password-toggle {
    position: absolute;
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border: 0;
    background: transparent;
    color: #1a1a1a;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.settings-eye-icon {
    width: 22px;
    height: 22px;
}

.settings-eye-closed {
    display: none;
}

.settings-password-toggle.is-visible .settings-eye-open {
    display: none;
}

.settings-password-toggle.is-visible .settings-eye-closed {
    display: block;
}

.settings-field input::placeholder {
    color: #9a9a9a;
}

.settings-field input[readonly] {
    color: #111111;
}

.settings-field input:focus {
    border-color: #f0b8b2;
    box-shadow: 0 0 0 4px rgba(223, 43, 31, 0.08);
    background: #ffffff;
}

.settings-field.has-error input {
    border-color: #df2b1f;
    background: #fff7f6;
}

.settings-field-error {
    min-height: 18px;
    padding: 6px 4px 0;
    font-size: 13px;
    font-weight: 600;
    color: #c32016;
}

.settings-password-hint {
    margin: 10px 0 0;
    text-align: center;
    font-size: 14px;
    line-height: 1.55;
    font-weight: 600;
    color: #000000;
}

.settings-form-message {
    min-height: 22px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    visibility: hidden;
}

.settings-form-message.is-visible {
    visibility: visible;
}

.settings-form-message.is-error {
    color: #c32016;
}

.settings-modal-actions {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 18px;
}

.settings-modal-submit {
    width: 100%;
    min-height: 68px;
    border: 0;
    border-radius: 20px;
    background: #e00000;
    color: #ffffff;
    font-size: 22px;
    font-weight: 500;
    cursor: pointer;
}

.settings-modal-submit:disabled {
    opacity: 0.7;
    cursor: wait;
}

.settings-modal-cancel {
    border: 0;
    background: transparent;
    color: #111111;
    font-size: 18px;
    font-weight: 500;
    cursor: pointer;
}

@media (max-width: 1024px) {
    body.profile-menu-open {
        overflow: hidden;
    }

    .primary-header {
        display: flex;
        justify-content: flex-end;
        min-height: 88px;
        padding: 18px 16px 14px;
    }

    .primary-header-spacer,
    .primary-header .menu-block {
        display: none;
    }

    .primary-header .profile {
        position: absolute;
        top: 16px;
        right: 16px;
        justify-self: auto;
    }

    .profile-menu {
        position: static;
    }

    .profile-backdrop {
        position: fixed;
        inset: 0;
        display: block;
        border: 0;
        background: rgba(20, 20, 20, 0.34);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity 0.22s ease, visibility 0.22s ease;
        z-index: 29990;
    }

    .profile-popover {
        position: fixed;
        top: 0;
        right: 0;
        width: min(78vw, 380px);
        height: 100vh;
        margin: 0;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transform: translateX(100%);
        transform-origin: top right;
        transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s ease;
        z-index: 30010;
    }

    .profile-menu:hover .profile-popover,
    .profile-menu:focus-within .profile-popover {
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transform: translateX(100%);
    }

    .profile-menu.is-open .profile-backdrop {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    .profile-menu.is-open .profile-popover {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: translateX(0);
    }

    .profile-card {
        width: 100%;
        min-height: 100%;
        margin: 0;
        padding: 86px 24px 28px;
        border-radius: 0;
        box-shadow: -24px 0 60px rgba(24, 24, 24, 0.16);
        overflow-y: auto;
    }

    .profile-close {
        position: absolute;
        top: 24px;
        right: 20px;
        width: 42px;
        height: 42px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border: 0;
        border-radius: 999px;
        background: #f0f0f0;
        cursor: pointer;
    }

    .profile-close span {
        position: absolute;
        width: 18px;
        height: 2px;
        border-radius: 999px;
        background: #1a1a1a;
    }

    .profile-close span:first-child {
        transform: rotate(45deg);
    }

    .profile-close span:last-child {
        transform: rotate(-45deg);
    }

    .profile-card-head {
        margin-bottom: 26px;
        padding-right: 0;
    }

    .profile-card-head h2 {
        font-size: 24px;
        margin-bottom: 12px;
    }

    .profile-mobile-nav {
        display: flex;
        flex-direction: column;
        gap: 0;
        margin-bottom: 24px;
        padding-bottom: 16px;
        border-bottom: 1px solid #e8e8e8;
    }

    .profile-nav-link {
        padding: 14px 0;
        font-size: 20px;
        border-bottom: 1px solid #f1f1f1;
    }

    .profile-nav-link:last-child {
        border-bottom: 0;
    }

    .profile-nav-link.active {
        color: #000000;
        text-decoration: underline;
        text-decoration-color: #df2e1f;
        text-underline-offset: 7px;
    }

    .profile-action {
        font-size: 20px;
    }

    .settings-modal {
        padding: 14px;
    }

    .settings-modal-panel {
        margin: 32px auto;
        padding: 44px 20px 28px;
    }
}

@media (max-width: 640px) {
    .toast-stack {
        top: 16px;
        right: 16px;
        left: 16px;
        width: auto;
    }

    .menu-block {
        gap: 10px;
    }

    .primary-header {
        padding: 18px 16px 16px;
    }

    .primary-header .profile {
        top: 14px;
        right: 14px;
    }

    .nav-primary {
        margin-top: 0;
    }

    .nav-primary a,
    .nav-secondary a,
    .nav .sep {
        font-size: 18px;
    }

    .profile-popover {
        width: min(88vw, 340px);
    }

    .profile-card {
        padding: 82px 20px 24px;
    }

    .profile-nav-link,
    .profile-action {
        font-size: 18px;
    }

    .settings-modal-title {
        font-size: 32px;
    }

    .settings-modal-submit {
        min-height: 58px;
        font-size: 20px;
    }
}
