:root {
    --red: #b41f2c;
    --gold-dark: #cfa864; /* Brighter gold for better contrast on dark */
    --gray: rgba(255, 255, 255, 0.12); /* Subtle borders */
    --light-gray: rgba(255, 255, 255, 0.06); /* Block/table header background */
    --dark-gray: #9ba4b5; /* Muted texts */
    --green: #0B8209;
    --orange: #FF9900;
    
    /* New design tokens */
    --bg-dark: #080a11;
    --bg-darker: #010204;
    --text-on-dark: #f0ece6;
    --gold-gradient: linear-gradient(135deg, #e8d099 0%, #cfa864 50%, #a38042 100%);
}

body {
    margin: 20px;
    min-height: calc(100% - 40px);
    background-color: var(--bg-dark);
    color: var(--text-on-dark);
    font-family: 'Lato', sans-serif;
}

p.success {
    border: 1px solid var(--green);
    padding: 5px;
    color: var(--green);
    border-radius: 5px;
    position: relative;
    display: flex;
    gap: 3px;
    align-items: center;
}

p.success:before {
    content: '\f12a';
    font-family: Dashicons;
    font-size: 16px;
}

p.success:after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background-color: var(--green);
    left: 0;
    top: 0;
    opacity: .1;
    z-index: 1;
}

.dashboard {
    display: grid;
    gap: 30px;
    grid-template-columns: repeat(3, 1fr);
}

a,
a:active {
    color: var(--gold-dark);
    text-decoration: none;
}

a:hover {
    color: #ffffff;
    text-decoration: underline;
}

section {
    padding: 0;
}

header {
    border-bottom: 1px solid var(--gray);
    padding-bottom: 20px;
}

header span {
    color: var(--dark-gray);
}

header a,
header a:active {
    color: var(--gold-dark);
}

header a:hover {
    color: #ffffff;
}

header,
.title {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
    text-align: right;
}

header>img {
    max-width: 100px;
}

.title h2 {
    color: var(--gold-dark);
    margin: 0;
}

.button,
button,
.wp-block-button__link {
    background: var(--gold-dark);
    border: none !important;
    color: white;
    text-decoration: none;
    font-size: 13px;
    margin: 0;
    padding: 5px 10px;
    cursor: pointer;
    border-width: 1px;
    border-style: solid;
    -webkit-appearance: none;
    border-radius: 3px;
    white-space: nowrap;
    box-sizing: border-box;
    transition: all .3s;
}

.button:hover,
button:hover,
.wp-block-button__link:hover {
    text-decoration: none;
    color: white;
    transform: scale(1.1);
}

.button-primary {
    background: black;
    border-color: black;
    color: white;
}

.button-primary:focus,
.button-primary:hover {
    background: var(--gold-dark);
    border-color: var(--gold-dark);
    color: white;
}

.login {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
}

.login > div {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    padding: 40px;
    border-radius: 16px;
    max-width: 400px;
    width: 100%;
}

.login img {
    display: block;
    margin: 0 auto 30px;
    max-width: 120px;
    height: auto;
}

.login form {
    max-width: 100%;
    margin: 0;
}

.login form p {
    margin-bottom: 20px;
}

.login form label {
    display: block;
    margin-bottom: 8px;
    color: var(--gold-dark);
    font-size: 14px;
    font-weight: 600;
}

.login form input[type="text"],
.login form input[type="password"] {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-on-dark);
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s ease;
}

.login form input[type="text"]:focus,
.login form input[type="password"]:focus {
    border-color: var(--gold-dark);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 2px rgba(207, 168, 100, 0.2);
}

.login #wp-submit {
    background: var(--gold-dark) !important;
    border: none !important;
    color: #fff !important;
    width: 100%;
    padding: 12px;
    font-size: 16px;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-shadow: none !important;
    box-shadow: none !important;
    height: auto;
}

.login #wp-submit:hover {
    background: #ffffff !important;
    color: var(--bg-dark) !important;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(207, 168, 100, 0.4) !important;
}

.login .error {
    color: #ff5252;
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
}

form.loading {
    position: relative;
}

form.loading>* {
    opacity: 0.1;
    pointer-events: none;
}

form.loading:before {
    content: 'carregando informações...';
    position: absolute;
    left: calc(50% - 80px);
    top: calc(50% - 10px);
    z-index: 9999;
    font-weight: 700;
}

form,
form>fieldset {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    max-width: 500px;
    width: 100%;
}

form>fieldset {
    margin-bottom: 20px;
}

form>fieldset>legend {
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--gold-dark);
}

form .form-field,
form p {
    min-width: 100%;
    min-width: 100%;
    margin: 0;
}

form .form-field.flex {
    display: flex;
    flex-wrap: wrap;
    column-gap: 10px;
}

form .form-field.flex>* {
    flex: 1;
}

form .form-field.flex label {
    min-width: 100%;
}

form .form-field input[type=text],
form .form-field input[type=email],
form .form-field input[type=number],
form .form-field input[type=date],
form .form-field select,
form>p input[type=text],
form>p input[type=password] {
    width: calc(100% - 2px);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-on-dark);
    outline: none;
    transition: all 0.3s;
}

form .form-field input:focus,
form .form-field select:focus {
    border-color: var(--gold-dark);
    background: rgba(255, 255, 255, 0.07);
}

form input:invalid,
form select:invalid {
    color: var(--gold-dark);
}

form .form-field select {
    padding: 0 5px;
    min-height: 40px;
    max-width: 100%;
    font-size: 14px;
}

form>p:last-child {
    margin-top: 10px;
}

form .form-field label,
form>p label {
    display: block;
    color: var(--gold-dark);
}

form [data-brand] {
    position: relative;
}

form [data-brand]:after {
    content: '';
    position: absolute;
    right: 10px;
    bottom: 5px;
    width: 20px;
    height: 20px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

form [data-brand="mastercard"]:after {
    background-image: url(../images/logo-master.webp);
}

form [data-brand="visa"]:after {
    background-image: url(../images/logo-visa.webp);
}

form [data-brand="amex"]:after {
    background-image: url(../images/logo-amex.webp);
}

form [data-brand="hipercard"]:after {
    background-image: url(../images/logo-hiper.webp);
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 20px;
}

/* STATS */

section.stats {
    grid-column: 1 / span 3;
}

section.stats form {
    display: flex;
    max-width: 195px;
    position: relative;
}

section.stats form .form-field {
    min-width: initial;
    flex: 1;
}

section.stats form .form-field:first-child {
    max-width: 75px;
}

section.leaders {
    grid-column: 1 / span 3;
}

section.regionals {
    grid-column: 1 / span 3;
}

section.nationals {
    grid-column: 1 / span 3;
}

.title-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.button-vertical-sale {
    background: var(--orange);
}

.col-id {
    width: 50px;
}

.col-count {
    width: 100px;
    text-align: center;
}

/* TABLE */

table,
table.widefat,
table.wp-list-table,
table th,
table td,
.widefat td,
.widefat th {
    white-space: nowrap;
    border: 1px solid var(--light-gray) !important;
    background-color: #070c14 !important;
    color: var(--text-on-dark) !important;
}

table th,
.widefat th {
    background-color: rgba(255, 255, 255, 0.05) !important;
    color: var(--gold-dark) !important;
    font-weight: bold;
}

table tr:nth-child(even) td,
table.widefat.striped tbody tr:nth-child(even) td,
table tr:nth-child(even),
table.widefat.striped tbody tr:nth-child(even) {
    background-color: #070c14 !important;
}

table tr:nth-child(odd) td,
table.widefat.striped tbody tr:nth-child(odd) td,
table tr:nth-child(odd),
table.widefat.striped tbody tr:nth-child(odd) {
    background-color: #030509 !important;
}

table .userinfo {
    position: relative;
    overflow-x: auto;
}

table strong {
    color: var(--gold-dark);
    font-size: 1rem;
}

table .dashicons {
    font-size: 18px;
    color: var(--gold-dark);
}

section.qrs {
    grid-column: 1 / span 3;
}

/* COMMISSION */

section.commission {
    grid-column: 1 / span 3;
}

section.commission span {
    font-weight: 700;
    color: var(--gold-dark);
}

section.commission li {
    padding: 10px 0;
    border-bottom: 1px solid var(--gray);
}

section.commission li:last-child {
    border: none;
    padding-bottom: 0;
}

section.commission li:before {
    content: "\f18e";
    font-family: Dashicons;
    margin-right: 5px;
    font-size: 20px;
    line-height: 20px;
    vertical-align: -5px;
    color: var(--gold-dark);
}

/* NEW CUSTOMER */

.new-customer .qr {
    text-align: center;
}

.new-customer .qr figure {
    width: 300px;
    height: 300px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--gray);
    background: white;
    margin: 20px auto;
}

.new-customer .qr figure:before {
    content: 'carregando QR...';
    position: absolute;
}

.new-customer .qr figure img {
    z-index: 1;
}

.new-customer .qr .button {
    display: inline-block;
}

section.box {
    background-color: #030508 !important;
    padding: 15px;
    border: 1px solid var(--gray);
}

section.chart {
    background-color: #010204 !important;
    padding: 15px 5px;
}

/* PROFILE */

section.profile {
    grid-column: 1 / span 1;
}

section.profile .info-section:not(:last-child) {
    border-bottom: 1px solid var(--gray);
}

/* STORE */

section.store a {
    word-break: break-all;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

/* UPDATE CARD */

.update-card form .navigation .prev2,
.update-card form legend {
    display: none;
}

/* GOALS */

section.goals {
    grid-column: 1 / span 3;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
}

section.goals .legend {
    background: var(--light-gray);
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    border-radius: 5px;
    grid-row: 2;
}

section.goals .legend p {
    font-weight: bold;
    font-size: 1rem;
    color: var(--text-on-dark);
}

section.goals .dashicons {
    display: block;
    font-size: 2rem;
    line-height: 1rem;
    margin: 0 auto;
    margin-bottom: 10px;
}

section.goals .legend span {
    color: var(--gold-dark);
}

section.goals .legend strong {
    color: var(--gold-dark);
    font-weight: 400;
}

section.bonus ul,
section.goals ul {
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 15px 0 0;
    grid-row: 1 / span 2;
}

section.bonus li,
section.goals li {
    padding-left: 15px;
    color: var(--dark-gray);
}

section.bonus li:last-child,
section.goals li:last-child {
    border: none;
    padding-bottom: 0;
}

section.goals li strong {
    color: var(--text-on-dark);
}

section.bonus li span,
section.goals li span {
    color: var(--gold-dark);
    font-weight: bold;
}

section.bonus li li:before,
section.goals li strong:before {
    content: '';
    width: 12px;
    height: 12px;
    border-radius: 100%;
    background-color: var(--gold-dark);
    display: inline-block;
    margin-left: -15px;
    margin-right: 5px;
    vertical-align: -1px;
}

section.goals li strong {
    display: block;
}

/* Neutralize the decorative bullet on the progress count <strong> inside .goal-info */
section.goals .goal-info strong {
    display: inline;
}

section.goals .goal-info strong:before {
    display: none;
}

/* E3 goals list — complex items with progress bars and status badges */

section.goals li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-left: 0;
    gap: 10px;
    flex-wrap: wrap;
}

.goal-info {
    /* flex-grow: 1; */
    min-width: 0;
}

.goal-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-on-dark);
    margin-bottom: 2px;
}

.goal-details {
    font-size: 0.85rem;
    color: var(--dark-gray);
}

.goal-reward {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--gold-dark);
    text-align: right;
    white-space: nowrap;
    flex-shrink: 0;
}

.goal-status {
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.goal-status.achieved {
    background: rgba(11, 130, 9, 0.12);
    color: var(--green);
}

.goal-status.expired {
    background: rgba(180, 31, 44, 0.1);
    color: var(--red);
}

.goal-status.active {
    background: rgba(163, 128, 66, 0.12);
    color: var(--gold-dark);
}

.goal-progress-bar-container {
    width: 100%;
    height: 5px;
    background: var(--light-gray);
    border-radius: 3px;
    margin-top: 6px;
    overflow: hidden;
}

.goal-progress-bar {
    height: 100%;
    background: var(--gold-dark);
    border-radius: 3px;
    transition: width 0.5s ease;
}

.goal-progress-bar.achieved {
    background: var(--green);
}

section.sellers {
    grid-column: 1 / span 3;
}

section.sellers-table {
    grid-column: 1 / span 3;
}


/* QR */

section.qr {
    margin-top: 30px;
}

section.qr img {
    width: 100%;
    max-width: 200px;
}



section.customers {
    grid-column: 1 / span 3;
}

section.bonus {
    grid-column: 1 / span 3;
    display: flex;
    flex-wrap: wrap;
}

section.bonus .container {
    flex: 1;
}

section.bonus strong {
    font-size: 1.2em;
    display: block;
    margin-bottom: 10px;
}

section.bonus ul {
    margin: 0;
    padding: 15px 15px 0;
    min-width: 250px;
    flex: 1;
}

section.bonus ul ul {
    padding: 10px 15px;
}

section.bonus li {
    padding: 0;
}

section.bonus li li {
    border: none;
}

section.sales,
.payments-history {
    grid-column: 1 / span 3;
}

footer {
    text-align: center;
    margin-top: 20px;
    padding: 20px;
    border-top: 1px solid var(--gray);
}

@media (max-width: 782px) {

    table .col-sales {
        width: 47px;
    }

    table .col-plans {
        width: 80px;
    }

    table .col-bonus {
        width: 52px;
    }

    form .form-field select {
        min-height: 40px;
        font-size: 16px;
    }

    .button,
    button {
        font-size: 16px;
    }

    section.goals {
        display: block;
    }

    section.goals .legend {
        border-radius: 0;
        margin-top: 30px;
    }

    section.goals .legend p {
        margin: 0;
    }

    section.goals .dashicons {
        display: inline-block;
        font-size: 20px;
        line-height: 20px;
        margin-bottom: 0;
    }

    section.goals li {
        flex-wrap: wrap;
        gap: 6px;
    }

    .goal-reward,
    .goal-status {
        margin-left: 0;
    }

    section.profile,
    section.store,
    section.subscription,
    section.open-charge,
    section.update-card,
    section.read-billing {
        grid-column: 1 / span 3;
    }

}

/* ── ApexCharts Overrides for Dark Mode ── */
.apexcharts-canvas text {
    fill: var(--text-on-dark) !important;
}
.apexcharts-title-text {
    fill: var(--gold-dark) !important;
}
.apexcharts-legend-text {
    color: var(--text-on-dark) !important;
}
.apexcharts-tooltip {
    background: var(--bg-darker) !important;
    border: 1px solid var(--gray) !important;
    color: var(--text-on-dark) !important;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5) !important;
}
.apexcharts-tooltip-title {
    background: var(--light-gray) !important;
    border-bottom: 1px solid var(--gray) !important;
    color: var(--gold-dark) !important;
}
.apexcharts-tooltip-text {
    color: var(--text-on-dark) !important;
}
.apexcharts-gridline,
.apexcharts-grid-borders line {
    stroke: var(--light-gray) !important;
}
.apexcharts-menu {
    background: var(--bg-darker) !important;
    border: 1px solid var(--gray) !important;
    color: var(--text-on-dark) !important;
}
.apexcharts-menu-item:hover {
    background: var(--light-gray) !important;
}

/* ── Additional ApexCharts Dark Theme Fixes ── */
.apexcharts-xaxis-line,
.apexcharts-yaxis-line,
.apexcharts-grid-borders line,
.apexcharts-gridline {
    stroke: rgba(255, 255, 255, 0.08) !important;
}
.apexcharts-radialbar-track path,
.apexcharts-track path {
    stroke: rgba(255, 255, 255, 0.08) !important;
}