.profile-page {
    position: relative;
    width: min(1120px,100%);
    margin: 0 auto;
    padding: 18px 0 28px;
    display: grid;
    gap: 26px
}

#profile-password-field {
    margin-bottom: 20px;
}

.profile-neon-lamp {
    position: fixed;
    z-index: 0;
    pointer-events: none;
    border-radius: 999px;
    filter: blur(.2px)
}

.profile-neon-lamp-top {
    top: 30px;
    left: 3%;
    right: 3%;
    height: 4px;
    background: #ffb62e;
    box-shadow: 0 0 8px #ffb62e,0 0 24px #ff8d00,0 0 48px #ff6a00
}

.profile-neon-lamp-right, .profile-neon-lamp-left {
    top: 12%;
    bottom: 9%;
    width: 4px
}

.profile-neon-lamp-right {
    right: 2.3%;
    background: #ff38c8;
    box-shadow: 0 0 8px #ff38c8,0 0 24px #ff159e,0 0 48px #c60081
}

.profile-neon-lamp-left {
    left: 2.3%;
    background: #28dbff;
    box-shadow: 0 0 8px #28dbff,0 0 24px #00a9ff,0 0 48px #006eff
}

.profile-card, .profile-tabs-shell {
    position: relative;
    z-index: 1;
    background: rgba(3,9,18,.9);
    border-radius: 14px;
    padding: 28px
}

.profile-card-heading {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 0;
    gap: 14px;
    margin-bottom: 18px
}

.profile-eyebrow {
    color: #8bd7e8;
    font-size: .82rem
}

.profile-card h1 {
    margin: 3px 0 5px;
    font-size: 1.55rem
}

.profile-card-heading p {
    margin: 0;
    color: var(--muted);
    font-size: .95rem
}

.profile-avatar {
    position: relative;
    left: auto;
    top: auto;
    width: 130px;
    height: 130px;
    color: #39e879;
    filter: drop-shadow(0 0 10px rgba(57,232,121,.75));
    transform: none;
    flex: none
}

    .profile-avatar svg {
        width: 100%;
        height: 100%;
        fill: none;
        stroke: currentColor;
        stroke-width: 2.2
    }

.profile-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px 22px
}

.profile-combobox {
    position: relative
}

    .profile-combobox > input {
        padding-left: 76px !important
    }

    .profile-combobox > button {
        position: absolute;
        left: 8px;
        top: 6px;
        width: 34px;
        height: 34px;
        border: 0;
        background: transparent;
        color: #b9cbd8;
        font-size: 1.2rem;
        cursor: pointer
    }

        .profile-combobox > button:not(.profile-combobox-clear) {
            display: grid;
            place-items: center;
            font-size: 0;
        }

            .profile-combobox > button:not(.profile-combobox-clear)::before {
                content: "";
                width: 9px;
                height: 9px;
                border-right: 2px solid currentColor;
                border-bottom: 2px solid currentColor;
                transform: rotate(45deg) translate(-2px, -2px);
                transition: transform .2s ease, color .2s ease;
            }

    .profile-combobox.is-open > button:not(.profile-combobox-clear)::before {
        transform: rotate(225deg) translate(-2px, -2px);
    }

    .profile-combobox .profile-combobox-clear {
        left: 44px;
        width: 26px;
        color: #a8bcc8;
        font-size: 1.1rem;
    }

        .profile-combobox .profile-combobox-clear:hover {
            color: #ff6f9e;
        }

.profile-combobox-options {
    display: none;
    position: absolute;
    z-index: 5;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-height: 190px;
    overflow-y: auto;
    padding: 5px;
    border: 1px solid rgba(39,231,255,.55);
    border-radius: 9px;
    background: #07111e;
    box-shadow: 0 0 18px rgba(39,231,255,.28)
}

.profile-combobox.is-open .profile-combobox-options {
    display: grid
}

.profile-combobox-options button {
    border: 0;
    border-radius: 6px;
    padding: 9px 11px;
    background: transparent;
    color: #e5edf4;
    text-align: right;
    font: inherit;
    cursor: pointer
}

    .profile-combobox-options button:hover {
        background: rgba(39,231,255,.15);
        color: var(--cyan)
    }

.profile-form label, .profile-gender {
    display: grid;
    gap: 7px
}

.profile-verification-actions {
    display: grid;
    gap: 10px
}

    /* The [hidden] attribute must win over the display: grid above,
       otherwise the verification field is visible from the start. */
    .profile-verification-actions[hidden] {
        display: none
    }

.profile-form label > span, .profile-gender legend {
    font-size: .9rem
}

.profile-form input, .profile-form select {
    width: 100%;
    height: 46px;
    border: 1px solid #23354b;
    border-radius: 9px;
    background: var(--surface-input);
    color: var(--text);
    font: inherit;
    padding: 0 14px;
    outline: none
}

    .profile-form input:focus, .profile-form select:focus {
        border-color: var(--cyan);
        box-shadow: 0 0 12px rgba(39,231,255,.25)
    }

.profile-gender {
    border: 0;
    padding: 0;
    margin: 0;
    grid-column: 1/-1;
    display: flex;
    gap: 10px
}

    .profile-gender legend {
        width: 100%;
        margin-bottom: 0
    }

    .profile-gender label {
        display: block;
        position: relative;
        flex: 1
    }

    .profile-gender input {
        position: absolute;
        opacity: 0
    }

    .profile-gender label span {
        display: block;
        text-align: center;
        border: 1px solid #ff4fae;
        border-radius: 9px;
        padding: 10px;
        background: linear-gradient(145deg, #ff61b7, #dd257f);
        color: #fff;
        transition: .25s
    }

    .profile-gender label:first-of-type span {
        border-color: #338fff;
        background: linear-gradient(145deg, #54b0ff, #2875d6);
        color: #fff
    }

    .profile-gender input:checked + span {
        border-color: #338fff;
        box-shadow: 0 0 16px rgba(76,168,255,.6)
    }

    .profile-gender label:nth-of-type(2) input:checked + span {
        border-color: #ff3fae;
        box-shadow: 0 0 16px rgba(255,63,174,.6)
    }

.profile-card.is-female .profile-avatar {
    color: #ff5fba;
    filter: drop-shadow(0 0 10px rgba(255,95,186,.75))
}

.profile-card.is-male .profile-avatar {
    color: #4ca8ff;
    filter: drop-shadow(0 0 10px rgba(76,168,255,.75))
}

.profile-save {
    grid-column: 1/-1;
    justify-self: start;
    border: 1px solid var(--green);
    border-radius: 9px;
    padding: 11px 28px;
    background: rgba(23,217,111,.12);
    color: #fff;
    font: inherit;
    cursor: pointer;
    box-shadow: 0 0 14px rgba(23,217,111,.25)
}

    .profile-save:hover {
        background: rgba(23,217,111,.22)
    }

.profile-resend-code {
    min-height: 44px;
    border: 1px solid #ff9a28;
    border-radius: 9px;
    background: linear-gradient(145deg, #ffae3d, #ec7418);
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 0 14px rgba(255,139,31,.35);
    transition: .25s
}

    .profile-resend-code:hover:not(:disabled) {
        transform: translateY(-1px);
        box-shadow: 0 0 18px rgba(255,139,31,.55)
    }

    /* Disabled resend button while the countdown is running. */
    .profile-resend-code:disabled {
        background: linear-gradient(145deg, #7a8290, #565e6a);
        border-color: #6b7280;
        color: #d1d5db;
        cursor: not-allowed;
        box-shadow: none;
        transform: none;
        opacity: .85
    }

/* The profile belongs to the learning area, so keep the centered book visible. */
body:has(.profile-page) .fixed-footer .mobile-footer-nav a:nth-child(2) img {
    filter: grayscale(0) drop-shadow(0 0 6px #34d399) drop-shadow(0 0 14px rgba(52,211,153,.8)) !important;
}

.profile-save-status {
    color: #73ffa9;
    margin: 0;
    align-self: center
}

.profile-tabs-shell {
    padding: 10px
}

.profile-tabs {
    display: grid;
    grid-template-columns: repeat(4,1fr);
    gap: 8px
}

.profile-tab {
    border: 1px solid transparent;
    border-radius: 9px;
    padding: 15px 10px;
    background: rgba(2,8,16,.72);
    color: #d6e5ee;
    font: inherit;
    cursor: pointer;
    transition: .2s
}

    .profile-tab span {
        margin-right: 7px;
        font-size: 1.15rem;
        color: var(--cyan)
    }

    .profile-tab:nth-child(2) span {
        color: #ff56b8
    }

    .profile-tab:nth-child(3) span {
        color: #ffc52e
    }

    .profile-tab:nth-child(4) span {
        color: #55d7ff
    }

    .profile-tab.is-active {
        border-color: var(--cyan);
        color: var(--cyan);
        box-shadow: 0 0 15px rgba(39,231,255,.45),inset 0 0 15px rgba(39,231,255,.12)
    }

.profile-panels {
    padding: 24px 14px 8px;
    min-height: 130px
}

.profile-panel h2 {
    font-size: 1.2rem;
    margin: 0 0 8px
}

.profile-panel p {
    color: var(--muted);
    margin: 0
}

.profile-empty {
    border: 1px dashed #2b4255;
    border-radius: 9px;
    padding: 18px;
    color: var(--muted)
}

.profile-course-list {
    display: grid;
    gap: 9px
}

    .profile-course-list article {
        display: flex;
        justify-content: space-between;
        gap: 12px;
        border-bottom: 1px solid #1b2c3b;
        padding: 10px 0
    }

    .profile-course-list b {
        color: #72ffa7;
        font-size: .85rem
    }

.payments-heading {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    margin-bottom: 14px
}

    .payments-heading h2 {
        margin: 0
    }

.payments-heading-icon {
    color: #e9edf3;
    font-size: 1.5rem;
    filter: drop-shadow(0 0 5px rgba(255,255,255,.4))
}

.payments-table-wrap {
    overflow-x: auto;
    border: 1px solid rgba(92,211,151,.28);
    border-radius: 8px
}

.payments-table {
    width: 100%;
    min-width: 680px;
    border-collapse: collapse;
    text-align: right
}

    .payments-table th, .payments-table td {
        padding: 13px 16px;
        border-bottom: 1px solid rgba(45,76,95,.42);
        white-space: nowrap
    }

    .payments-table th {
        background: rgba(19,40,54,.55);
        font-weight: 500;
        color: #cbd6df
    }

    .payments-table td {
        color: #e8edf1
    }

    .payments-table .class-range-start {
        color: #55e889;
        font-weight: 800;
    }

    .payments-table .class-range-end {
        color: #ff5f6d;
        font-weight: 800;
    }

    .payments-table tbody tr:last-child td {
        border-bottom: 0
    }

    .payments-table th:nth-child(2), .payments-table td:nth-child(2), .payments-table th:nth-child(3), .payments-table td:nth-child(3), .payments-table th:nth-child(4), .payments-table td:nth-child(4) {
        text-align: center
    }

.payment-status {
    display: inline-block;
    min-width: 65px;
    padding: 4px 9px;
    border-radius: 6px;
    text-align: center;
    font-size: .84rem
}

.payment-status-success {
    color: #ffffff;
    background: rgba(0,177,78,.66);
    border: 1px solid #008f43;
    box-shadow: 0 0 9px rgba(0,255,111,.22)
}

.payment-status-pending {
    color: #ffffff;
    background: #ff7c16;
    border: 1px solid #966000
}

.payment-status-failed {
    color: #ffffff;
    background: rgba(191,0,86,.66);
    border: 1px solid #b50055
}

.payment-type {
    font-size: 1.45rem;
    line-height: 1
}

.payment-type-course {
    color: #5effa2
}

.payment-type-code {
    color: #ffc323;
    font-weight: 700;
    font-size: 1rem
}

.payment-type-exam {
    color: #4dff9c
}

.payment-type-design {
    color: #ff4ca7
}

.payments-empty {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    border: 1px dashed rgba(92, 211, 151, .35);
    border-radius: 14px;
    padding: 34px 18px;
    text-align: center
}

    .payments-empty[hidden] {
        display: none;
    }

    .payments-empty:not([hidden]) {
        display: flex;
    }

.payments-empty-icon {
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    margin-bottom: 6px;
    border: 1px solid rgba(92, 211, 151, .4);
    border-radius: 14px;
    color: #5effa2;
    background: rgba(23, 217, 111, .08);
    box-shadow: 0 0 16px rgba(23, 217, 111, .18)
}

    .payments-empty-icon svg {
        width: 28px;
        height: 28px;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.7;
        stroke-linecap: round;
        stroke-linejoin: round
    }

.payments-empty-title {
    margin: 0;
    color: var(--text);
    font-weight: 700;
    font-size: 1rem
}

.payments-empty-desc {
    margin: 0;
    color: var(--muted);
    font-size: .88rem
}

:root.light-theme .payments-empty {
    border-color: rgba(8, 125, 158, .35);
    background: rgba(231, 243, 248, .5)
}

:root.light-theme .payments-empty-icon {
    color: #087d9e;
    border-color: rgba(8, 125, 158, .4);
    background: rgba(8, 125, 158, .07)
}

:root.light-theme .payments-empty-title {
    color: #173247;
}

:root.light-theme .payments-empty-desc {
    color: #4b6c7f;
}

/* Light theme overrides for the profile surface and controls. */
:root.light-theme .profile-card,
:root.light-theme .profile-tabs-shell {
    background: linear-gradient(145deg, rgba(255,255,255,.96), rgba(235,247,253,.96));
    color: #173247;
    box-shadow: 0 10px 28px rgba(54,106,145,.16);
}

:root.light-theme .profile-form input,
:root.light-theme .profile-form select {
    border-color: rgba(8,125,158,.35);
    background: #fff;
    color: #173247;
}

    :root.light-theme .profile-form input[name=verificationCode] {
        letter-spacing: .5em;
        text-align: center;
        font-weight: 600;
        direction: ltr;
    }

:root.light-theme .profile-combobox-options {
    border-color: rgba(8,125,158,.4);
    background: #fff;
    box-shadow: 0 10px 22px rgba(54,106,145,.18);
}

    :root.light-theme .profile-combobox-options button {
        color: #24445b;
    }

        :root.light-theme .profile-combobox-options button:hover {
            background: #e7f6fb;
            color: #087d9e;
        }

:root.light-theme .profile-combobox > button {
    color: #31566d;
}

:root.light-theme .profile-combobox .profile-combobox-clear {
    color: #6b8190;
}

:root.light-theme .profile-tab {
    background: linear-gradient(145deg, #f8fcff, #e8f4fa);
    border-color: rgba(8,125,158,.2);
    color: #31566d;
}

    :root.light-theme .profile-tab.is-active {
        color: #087d9e;
        background: #fff;
    }

:root.light-theme .payments-table-wrap {
    border-color: rgba(8,125,158,.3);
}

:root.light-theme .payments-table th {
    background: #e7f3f8;
    color: #31566d;
}

:root.light-theme .payments-table td {
    color: #173247;
    border-bottom-color: rgba(8,125,158,.16);
}

:root.light-theme .profile-empty {
    border-color: rgba(8,125,158,.35);
    color: #31566d;
}

:root.light-theme .profile-save {
    border-color: #0a9c52;
    background: #0a9c52;
    color: #fff;
    font-weight: 700;
    box-shadow: 0 4px 14px rgba(10,156,82,.35);
}

    :root.light-theme .profile-save:hover {
        background: #088545;
        border-color: #088545;
    }

.profile-logout {
    position: relative;
    z-index: 1;
    justify-self: center;
    border: 1px solid #ff3d4d;
    border-radius: 9px;
    color: #ff6c76;
    padding: 13px 38px;
    font-size: 1.1rem;
    box-shadow: 0 0 15px rgba(255,61,77,.35);
    transition: .2s
}

    .profile-logout:hover {
        background: rgba(255,61,77,.12);
        box-shadow: 0 0 22px rgba(255,61,77,.55)
    }

    /* Arrow sits on the right side of the (RTL) label. */
    .profile-logout span {
        font-size: 1.4rem;
        margin-left: 9px;
        vertical-align: middle
    }

/* Refined tab navigation and responsive payment cards. */
.profile-tabs {
    gap: 12px;
}

.profile-tab {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 66px;
    border-color: rgba(94, 211, 151, .2);
    background: linear-gradient(145deg, rgba(8, 20, 30, .9), rgba(5, 12, 24, .82));
    font-weight: 700;
}

.profile-tab-icon {
    display: inline-grid !important;
    place-items: center;
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    margin: 0 !important;
    border: 1px solid currentColor;
    border-radius: 10px;
    color: var(--cyan);
}

    .profile-tab-icon svg {
        width: 20px;
        height: 20px;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.7;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

.profile-tab-label {
    margin: 0 !important;
    color: inherit !important;
    font-size: .95rem;
}

.profile-tab.is-active .profile-tab-icon {
    background: rgba(39, 231, 255, .1);
    box-shadow: 0 0 12px rgba(39, 231, 255, .35);
}

.payments-table-wrap {
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .16);
}

.payments-table th {
    font-size: .86rem;
}

.payments-table td {
    font-size: .92rem;
}

@media(max-width:700px) {
    .profile-page {
        padding: 4px 0 12px;
        gap: 12px
    }

    .profile-card, .profile-tabs-shell {
        padding: 18px 14px;
        margin: 0
    }

    .profile-neon-lamp {
        display: none;
    }

    .profile-card-heading {
        align-items: center;
    }

    .profile-avatar {
        width: 82px;
        height: 82px
    }

    .profile-card h1 {
        font-size: 1.25rem
    }

    .profile-card-heading p {
        font-size: .82rem
    }

    .profile-form {
        grid-template-columns: 1fr;
        gap: 13px
    }

    .profile-gender {
        grid-column: auto
    }

    .profile-save {
        grid-column: auto;
        width: 100%
    }

    .profile-save-status {
        grid-column: auto;
        text-align: center
    }

    .profile-tabs {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px
    }

    .profile-tab {
        min-height: 74px;
        flex-direction: column;
        gap: 6px;
        font-size: .78rem;
        padding: 10px 6px;
        line-height: 1.5
    }

    .profile-tab-icon {
        flex-basis: 30px;
        width: 30px;
        height: 30px
    }

        .profile-tab-icon svg {
            width: 18px;
            height: 18px
        }

    .profile-tab-label {
        display: block !important;
        font-size: .78rem
    }

    .profile-panels {
        padding: 18px 0 4px
    }

    .payments-heading {
        padding: 0 4px;
        margin-bottom: 12px;
        justify-content: center;
    }

        .payments-heading h2 {
            font-size: 1.05rem
        }

    .payments-table-wrap {
        overflow: visible;
        border: 0;
        box-shadow: none
    }

    .payments-table[hidden] {
        display: none !important
    }

    .payments-table,
    .payments-table tbody,
    .payments-table tr,
    .payments-table td {
        display: block;
        width: 100%;
        min-width: 0
    }

    .payments-table {
        text-align: right
    }

        .payments-table thead {
            display: none
        }

        .payments-table tbody {
            display: grid;
            gap: 10px
        }

        .payments-table tr {
            padding: 12px;
            border: 1px solid rgba(92, 211, 151, .24);
            border-radius: 13px;
            background: linear-gradient(145deg, rgba(10, 25, 36, .94), rgba(5, 13, 24, .9));
            box-shadow: 0 6px 16px rgba(0, 0, 0, .16)
        }

        .payments-table td {
            display: grid;
            grid-template-columns: 82px minmax(0, 1fr);
            gap: 8px;
            align-items: center;
            padding: 7px 0;
            border-bottom: 1px solid rgba(45, 76, 95, .34);
            white-space: normal;
            text-align: right !important;
            line-height: 1.7
        }

        /* The desktop rule that removes borders on the last row also kills the
       cell separators on mobile, where those borders are the lines between
       cells. Restore them; only the very last cell stays borderless. */
        .payments-table tbody tr:last-child td {
            border-bottom: 1px solid rgba(45, 76, 95, .34)
        }

            .payments-table tbody tr:last-child td:last-child {
                border-bottom: 0
            }

        .payments-table td::before {
            content: attr(data-label);
            color: #8da6b8;
            font-size: .72rem;
            font-weight: 700
        }

        .payments-table td:last-child {
            border-bottom: 0;
            padding-bottom: 0
        }

        .payments-table td:first-child {
            color: var(--text);
            font-weight: 700
        }

        .payments-table td:last-child {
            grid-template-columns: 82px minmax(0, 1fr);
        }

    :root.light-theme .payments-table tr {
        border-color: rgba(8, 125, 158, .28);
        background: linear-gradient(145deg, #ffffff, #edf8fc);
        box-shadow: 0 6px 16px rgba(54, 106, 145, .14)
    }

    :root.light-theme .payments-table td {
        color: #173247;
        border-bottom-color: rgba(8, 125, 158, .16)
    }

        :root.light-theme .payments-table td::before {
            color: #4b6c7f
        }

    .profile-neon-lamp-top {
        top: 75px;
        left: 8%;
        right: 8%
    }

    .profile-neon-lamp-right {
        right: 5px;
        width: 3px
    }

    .profile-neon-lamp-left {
        left: 5px;
        width: 3px
    }
}
