.profile-shell {
    --profile-card-bg: #ffffff;
    --profile-border: #eef2f7;
    --profile-muted: #64748b;
    --profile-strong: #111827;
    --profile-soft: #f8fafc;
    --profile-accent: #2563eb;
}

body[data-theme="dark"] .profile-shell {
    --profile-card-bg: #182230;
    --profile-border: rgba(148, 163, 184, .16);
    --profile-muted: #a7b3c5;
    --profile-strong: #f8fafc;
    --profile-soft: rgba(15, 23, 42, .42);
    --profile-accent: #60a5fa;
}

.profile-card {
    background: var(--profile-card-bg);
    border: 1px solid var(--profile-border);
    border-radius: 14px;
    box-shadow: 0 14px 36px rgba(15, 23, 42, .04);
}

.profile-card-title {
    color: var(--profile-strong);
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
}

.profile-card-subtitle,
.profile-help-text {
    color: var(--profile-muted);
    font-size: 14px;
    line-height: 1.55;
}

.profile-identity {
    display: flex;
    gap: 18px;
    align-items: center;
}

.profile-avatar-wrap {
    position: relative;
    width: 112px;
    min-width: 112px;
    height: 112px;
    overflow: visible;
    perspective: 900px;
}

.profile-avatar {
    width: 112px;
    height: 112px;
    border-radius: 24px;
    border: 1px solid var(--profile-border);
    object-fit: cover;
    background: linear-gradient(135deg, #2563eb, #14b8a6);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 42px;
    font-weight: 800;
    overflow: hidden;
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
    cursor: pointer;
}

.profile-avatar-rotator {
    position: relative;
    transform-style: preserve-3d;
    animation: profileAvatarSpin 8s ease-in-out infinite;
    background: transparent;
    overflow: visible;
    transition: transform .55s cubic-bezier(.22, 1, .36, 1);
}

.profile-avatar-rotator.is-manual-logo,
.profile-avatar-rotator.is-manual-user {
    animation: none;
}

.profile-avatar-rotator.is-manual-logo {
    transform: rotateY(180deg);
}

.profile-avatar-rotator.is-manual-user {
    transform: rotateY(0deg);
}

.profile-avatar-face {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    border-radius: 24px;
    overflow: hidden;
    backface-visibility: hidden;
    border: 1px solid var(--profile-border);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22);
}

.profile-avatar-logo {
    background: #fff;
    transform: rotateY(180deg);
}

.profile-avatar-logo img {
    width: 72%;
    height: 72%;
    object-fit: contain;
}

.profile-avatar-user {
    transform: rotateY(0deg);
    background: linear-gradient(135deg, #2563eb, #14b8a6);
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    color: #fff;
}

body[data-theme="dark"] .profile-avatar-logo {
    background: #0f172a;
}

@keyframes profileAvatarSpin {
    0%, 42% {
        transform: rotateY(0deg);
    }

    50%, 92% {
        transform: rotateY(180deg);
    }

    100% {
        transform: rotateY(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .profile-avatar-rotator {
        animation: none;
    }
}

.profile-avatar-upload {
    position: absolute;
    right: -8px;
    bottom: -8px;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    border: 3px solid var(--profile-card-bg);
    background: var(--profile-accent);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.profile-avatar-upload input {
    display: none;
}

.profile-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 10px;
    border-radius: 999px;
    background: var(--profile-soft);
    color: var(--profile-muted);
    border: 1px solid var(--profile-border);
    font-size: 13px;
    font-weight: 600;
}

.profile-section-label {
    color: var(--profile-strong);
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 9px;
}

.profile-shell .form-control,
.profile-shell .form-select {
    border-color: var(--profile-border);
    min-height: 46px;
}

.profile-shell .form-control,
.profile-shell .form-select,
.profile-shell textarea.form-control {
    background-color: var(--profile-card-bg);
    color: var(--profile-strong);
}

.profile-shell .form-control::placeholder,
.profile-shell textarea.form-control::placeholder {
    color: var(--profile-muted);
    opacity: 1;
}

body[data-theme="dark"] .profile-shell .form-control,
body[data-theme="dark"] .profile-shell .form-select,
body[data-theme="dark"] .profile-shell textarea.form-control {
    background-color: #131f2d !important;
    border-color: rgba(148, 163, 184, .22) !important;
    color: #e5edf7 !important;
}

body[data-theme="dark"] .profile-shell .form-control:focus,
body[data-theme="dark"] .profile-shell .form-select:focus,
body[data-theme="dark"] .profile-shell textarea.form-control:focus {
    background-color: #131f2d !important;
    border-color: #60a5fa !important;
    color: #f8fafc !important;
    box-shadow: 0 0 0 .2rem rgba(96, 165, 250, .16);
}

body[data-theme="dark"] .profile-shell .form-control::placeholder,
body[data-theme="dark"] .profile-shell textarea.form-control::placeholder {
    color: #94a3b8 !important;
}

body[data-theme="dark"] .profile-shell .form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23cbd5e1' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e") !important;
}

body[data-theme="dark"] .profile-shell .form-select option {
    background-color: #131f2d;
    color: #e5edf7;
}

body[data-theme="dark"] .profile-shell input:-webkit-autofill,
body[data-theme="dark"] .profile-shell input:-webkit-autofill:hover,
body[data-theme="dark"] .profile-shell input:-webkit-autofill:focus {
    -webkit-text-fill-color: #e5edf7;
    box-shadow: 0 0 0 1000px #131f2d inset;
    caret-color: #e5edf7;
}

.profile-shell textarea.form-control {
    min-height: 110px;
}

.profile-shell {
    padding-bottom: 132px;
}

.profile-meta-list {
    display: grid;
    gap: 12px;
}

.profile-meta-item {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--profile-border);
}

.profile-meta-item:last-child {
    border-bottom: 0;
}

.profile-meta-item span:first-child {
    color: var(--profile-muted);
    font-weight: 600;
}

.profile-meta-item span:last-child {
    color: var(--profile-strong);
    font-weight: 700;
    text-align: right;
}

.profile-sticky-actions {
    position: fixed;
    right: 32px;
    bottom: 22px;
    left: 312px;
    z-index: 1040;
    margin-bottom: 0 !important;
    box-shadow: 0 22px 54px rgba(15, 23, 42, .2);
}

body[data-theme="dark"] .profile-sticky-actions {
    box-shadow: 0 18px 44px rgba(0, 0, 0, .32);
}

@media (max-width: 575px) {
    .profile-identity {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 1199px) {
    .profile-sticky-actions {
        left: 24px;
        right: 24px;
    }
}

@media (max-width: 575px) {
    .profile-sticky-actions {
        right: 12px;
        bottom: 12px;
        left: 12px;
    }
}


.account-settings-tabs {
    display: grid;
    grid-template-columns: repeat(6, minmax(132px, 1fr));
    gap: 10px;
    width: 100%;
}

.account-settings-tabs .btn {
    min-height: 50px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: normal;
    line-height: 1.2;
}

.account-settings-panel[hidden] {
    display: none !important;
}

@media (max-width: 1399px) {
    .account-settings-tabs {
        grid-template-columns: repeat(3, minmax(150px, 1fr));
    }
}

@media (max-width: 767px) {
    .account-settings-tabs {
        grid-template-columns: repeat(2, minmax(130px, 1fr));
    }
}

@media (max-width: 575px) {
    .account-settings-tabs {
        grid-template-columns: 1fr;
    }
}


.account-toggle-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    cursor: pointer;
    min-height: 56px;
}

.account-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.account-toggle-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.account-toggle-track {
    position: relative;
    width: 54px;
    height: 28px;
    border-radius: 999px;
    background: rgba(148, 163, 184, .35);
    border: 1px solid rgba(148, 163, 184, .55);
    transition: background .2s ease, border-color .2s ease;
}

.account-toggle-knob {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(15, 23, 42, .22);
    transition: transform .2s ease;
}

.account-toggle-text {
    min-width: 28px;
    color: var(--profile-muted);
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
}

.account-toggle-text::before {
    content: "OFF";
}

.account-toggle-input:checked + .account-toggle-track {
    background: #635bff;
    border-color: #635bff;
}

.account-toggle-input:checked + .account-toggle-track .account-toggle-knob {
    transform: translateX(26px);
}

.account-toggle-input:checked ~ .account-toggle-text {
    color: var(--profile-accent);
}

.account-toggle-input:checked ~ .account-toggle-text::before {
    content: "ON";
}

.account-toggle-input:focus-visible + .account-toggle-track {
    box-shadow: 0 0 0 .2rem rgba(99, 91, 255, .2);
}

.profile-shell .form-control.is-disabled,
.profile-shell .form-control:disabled {
    opacity: .6;
    cursor: not-allowed;
}

body[data-theme="dark"] .account-toggle-track {
    background: rgba(15, 23, 42, .95);
    border-color: rgba(148, 163, 184, .42);
}

body[data-theme="dark"] .account-toggle-input:checked + .account-toggle-track {
    background: #635bff;
    border-color: #786eff;
}


.policy-mini-card {
    display: flex;
    flex-direction: column;
    min-height: 104px;
}

.policy-view-btn {
    align-self: flex-end;
    margin-top: auto;
    border: 1px solid rgba(99, 91, 255, .35);
    border-radius: 6px;
    background: rgba(99, 91, 255, .1);
    color: var(--profile-accent);
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    padding: 6px 10px;
}

.policy-view-btn:hover,
.policy-view-btn:focus-visible {
    background: #635bff;
    border-color: #635bff;
    color: #fff;
}

body[data-theme="dark"] .policy-view-btn {
    background: rgba(99, 91, 255, .16);
    border-color: rgba(120, 110, 255, .45);
}

body[data-theme="dark"] .policy-view-btn:hover,
body[data-theme="dark"] .policy-view-btn:focus-visible {
    background: #635bff;
    border-color: #786eff;
    color: #fff;
}
