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

body.no-scroll {
    overflow: hidden;
}

.profile-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: 0.3s ease;
}

.profile-overlay.active {
    opacity: 1;
    visibility: visible;
}

.profile-dialog {
    position: relative;
    top: 24px;
    right: 24px;
    width: calc(100% - 310px);
    max-width: 1100px;
    background-color: var(--surface);
    border-radius: 16px;
    transform: translateX(100%);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    margin-left: auto;
}

.profile-overlay.active .profile-dialog {
    transform: translateX(0);
    opacity: 1;
}

.profile-close {
    position: absolute;
    top: 16px;
    left: -32px;
    width: 32px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--accent);
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
    color: var(--accent-contrast);
    padding: 4px 0;
}

.profile-close:hover {
    background-color: var(--accent-hover);
}

.profile-close__icon {
    width: 20px;
    height: 20px;
    display: block;
}

.profile {
    height: calc(100vh - 48px);
    overflow: auto;
    display: grid;
    grid-template-columns: 288px 1fr;
    gap: 24px;
    align-items: flex-start;
    background-color: var(--surface-2);
    border-radius: 16px;
    font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    line-height: 1.5;
    padding: 24px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.profile-left,
.profile-right {
    background-color: var(--surface);
    border-radius: 8px;
    padding: 24px;
    box-shadow: rgba(0, 0, 0, 0.05) 0px 1px 2px;
}

.profile-left__section + .profile-left__section {
    border-top: 1px solid var(--border);
    padding-top: 24px;
    margin-top: 24px;
}

.profile-header {
    text-align: center;
}

.profile-header__avatar {
    overflow: hidden;
    width: 128px;
    height: 128px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--accent);
    border-radius: 50%;
    font-size: 36px;
    font-weight: 700;
    line-height: 1;
    text-transform: uppercase;
    color: var(--accent-contrast);
    margin-right: auto;
    margin-bottom: 16px;
    margin-left: auto;
}

.profile-header__avatar > img {
    -o-object-fit: cover;
    object-fit: cover;
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    display: block;
}

.profile-header__title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    margin-top: 0;
    margin-bottom: 4px;
}

.profile-header__name,
.profile-header__surname {
    text-transform: capitalize;
}

.profile-header__position {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.profile-header__joined {
    font-size: 12px;
    color: var(--text-faint);
    margin-bottom: 16px;
}

.profile-header__rolelist {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.profile-header__role {
    display: inline-block;
    background: var(--accent);
    border-radius: 100px;
    font-size: 12px;
    font-weight: 500;
    color: var(--accent-contrast);
    padding: 4px 12px;
}

.profile-stats__info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 24px;
}

.profile-stats__block {
    font-size: 12px;
    text-align: center;
    color: var(--text-muted);
}

.profile-stats__amount,
.profile-stats__percent {
    font-size: 24px;
    font-weight: 700;
}

.profile-stats__amount {
    color: var(--accent-hover);
}

.profile-stats__percent {
    color: var(--success);
}

.profile-stats__action {
    display: flex;
    gap: 8px;
}

.profile-stats__edit {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
    flex-grow: 1;
    background-color: var(--accent);
    border-radius: 4px;
    color: var(--accent-contrast);
    padding: 8px 12px;
}

.profile-stats__edit:hover {
    background-color: var(--accent-hover);
}

.profile-stats__options {
    background-color: var(--surface-2);
    border-radius: 4px;
    color: var(--text-muted);
    padding: 8px;
}

.profile-stats__options:hover {
    background-color: var(--border);
}

.profile-stats__icon {
    width: 16px;
    height: 16px;
    display: block;
}

.profile-info:not(.edit-mode) .profile-info__contacts .profile-info__group {
    display: flex;
    gap: 8px;
    align-items: center;
}

.profile-info__group + .profile-info__group {
    margin-top: 16px;
}

.profile-info__label {
    cursor: text;
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.profile-info:not(.edit-mode) .profile-info__label {
    pointer-events: none;
}

.profile-info:not(.edit-mode) .profile-info__contacts .profile-info__label {
    display: none;
}

.profile-info__input {
    width: 100%;
    font-size: 14px;
    color: var(--text);
}

.profile-info:not(.edit-mode) .profile-info__input {
    -webkit-user-select: text;
    -moz-user-select: text;
    user-select: text;
    caret-color: transparent;
    cursor: text;
    background: none;
    border: none;
    outline: none;
}

.edit-mode .profile-info__input {
    border: 1px solid var(--border-strong);
    border-radius: 4px;
    padding: 8px 12px;
}

.edit-mode .profile-info__input:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--accent);
}

.profile-info__select {
    width: 100%;
    border: 1px solid var(--border-strong);
    border-radius: 4px;
    font-size: 14px;
    padding: 8px 12px;
}

.profile-info:not(.edit-mode) .profile-info__select {
    display: none;
}

.profile-info__pseudoselect {
    font-size: 14px;
    color: var(--text);
}

.edit-mode .profile-info__pseudoselect {
    display: none;
}

.profile-info:not(.edit-mode) .profile-info__action {
    display: none;
}

.profile-info__contacts {
    margin-top: 16px;
}

.profile-info:not(.edit-mode) .profile-info__contacts {
    border-top: 1px solid var(--border);
    padding-top: 24px;
    margin-top: 24px;
}

.profile-info__icon {
    width: 16px;
    height: 16px;
    display: block;
    color: var(--text-faint);
}

.edit-mode .profile-info__icon {
    display: none;
}

.profile-info__action {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 32px;
}

.profile-info__button {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
    border-radius: 4px;
    font-size: 14px;
    padding: 8px 12px;
}

.profile-info__button--save {
    background-color: var(--success);
    color: var(--accent-contrast);
}

.profile-info__button--save:hover {
    background-color: var(--success);
}

.profile-info__button--cancel {
    background-color: var(--border-strong);
    color: var(--text);
}

.profile-info__button--cancel:hover {
    background-color: var(--text-faint);
}

.profile-info__svg {
    width: 16px;
    height: 16px;
    display: block;
}

.profile-programs {
    list-style: none;
    margin: 0;
    padding: 0;
}

.profile-programs__item + .profile-programs__item {
    border-top: 1px solid var(--border);
    padding-top: 36px;
    margin-top: 36px;
}

.profile-program__inner {
    margin-top: 24px;
}

.profile-program-header {
    display: flex;
    gap: 12px;
    align-items: center;
}

.profile-program-header__logo {
    overflow: hidden;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    background-color: var(--accent);
    border-radius: 50%;
    color: var(--accent-contrast);
}

.profile-program-header__logo > img {
    -o-object-fit: cover;
    object-fit: cover;
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    display: block;
}

.profile-program-header__title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.profile-program-header__subtitle {
    font-size: 12px;
    color: var(--text-muted);
}

.profile-program-header__toggler {
    background-color: transparent;
    color: var(--text-faint);
    margin-left: auto;
}

.profile-program-header__toggler:hover {
    color: var(--text-muted);
}

.profile-program.is-open .profile-program-header__toggler {
    transform: scaleY(-1);
}

.profile-program-header__chevron {
    width: 20px;
    height: 20px;
    display: block;
}

.profile-program-inner {
    display: none;
}

.profile-program.is-open .profile-program-inner {
    display: block;
}

.profile-program-inner__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.profile-program-inner__item {
    padding-bottom: 32px;
}

.profile-program-inner__item:last-child {
    padding-bottom: 0;
}

.profile-program-inner__item:not(:last-child) {
    position: relative;
    z-index: 1;
}

.profile-program-inner__item:not(:last-child)::before {
    content: "";
    position: absolute;
    z-index: 0;
    top: 0;
    bottom: 0;
    left: 15px;
    width: 2px;
    background-color: var(--border-strong);
}

.profile-program-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.profile-program-item__content {
    flex: 1;
    margin-left: 16px;
}

.profile-program-item__actions {
    margin-left: auto;
    padding-left: 12px;
    flex-shrink: 0;
}

.profile-program-item__result-btn {
    padding: 6px 10px;
    font-size: 12px;
    cursor: pointer;
    background-color: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    white-space: nowrap;
    transition: background-color 0.15s;
}

.profile-program-item__result-btn:hover {
    background-color: var(--border);
}

.profile-program-item__icon {
    position: relative;
    z-index: 2;
    overflow: hidden;
    width: 32px;
    height: 32px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    border-radius: 50%;
    outline: 10px solid var(--surface);
    font-size: 12px;
    font-weight: 700;
    color: var(--accent-contrast);
}

.profile-program-item--green .profile-program-item__icon {
    background-color: var(--success);
}

.profile-program-item--yellow .profile-program-item__icon {
    background-color: var(--warning);
}

.profile-program-item__status {
    margin-bottom: 4px;
}

.profile-program-item__state {
    font-size: 14px;
    font-weight: 500;
    color: var(--success);
}

.profile-program-item__time {
    font-size: 12px;
    color: var(--text-muted);
    margin-left: 8px;
}

.profile-program-item__descr {
    font-size: 14px;
    color: var(--text);
}

/* ===== ANSWERS MODAL ===== */

.answers-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1100;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 40px 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    overflow-y: auto;
}

.answers-overlay.active {
    opacity: 1;
    visibility: visible;
}

.answers-dialog {
    position: relative;
    width: 100%;
    max-width: 620px;
    background: var(--surface);
    border-radius: 12px;
    padding: 28px 28px 32px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
    transform: translateY(-16px);
    transition: transform 0.2s ease;
    margin-bottom: 40px;
}

.answers-overlay.active .answers-dialog {
    transform: translateY(0);
}

.answers-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--surface-2);
    border-radius: 6px;
    color: var(--text-muted);
    transition: background-color 0.15s;
}

.answers-close:hover {
    background-color: var(--border);
}

.answers-close__icon {
    width: 18px;
    height: 18px;
    display: block;
}

.answers-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 24px 0;
    padding-right: 40px;
}

.answers-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.answers-item {
    border-radius: 8px;
    border: 1px solid var(--border);
    padding: 16px 18px;
}

.answers-item--correct {
    border-color: var(--success);
    background-color: var(--success-soft);
}

.answers-item--wrong {
    border-color: var(--danger-soft);
    background-color: var(--danger-soft);
}

.answers-item__number {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.answers-item__question {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 12px;
}

.answers-item__row {
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 13px;
    margin-bottom: 4px;
}

.answers-item__row:last-child {
    margin-bottom: 0;
}

.answers-item__row-label {
    font-weight: 500;
    color: var(--text-muted);
    flex-shrink: 0;
}

.answers-item__row-value {
    color: var(--text);
}

.answers-item--correct .answers-item__row-value--student {
    color: var(--success);
    font-weight: 600;
}

.answers-item--wrong .answers-item__row-value--student {
    color: var(--danger-hover);
    font-weight: 600;
}

.answers-item__badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 100px;
    margin-bottom: 10px;
}

.answers-item--correct .answers-item__badge {
    background-color: var(--success-soft);
    color: var(--success);
}

.answers-item--wrong .answers-item__badge {
    background-color: var(--danger-soft);
    color: var(--danger-hover);
}