:root {
    --bg: #f6f3ee;
    --surface: #ffffff;
    --surface-2: #eef4f1;
    --text: #242426;
    --muted: #6f746f;
    --line: #ddd7ce;
    --primary: #126c57;
    --primary-2: #0e5747;
    --accent: #b77a20;
    --danger: #a63d40;
    --success: #20744d;
    --shadow: 0 18px 45px rgba(31, 34, 32, .08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.5;
}

.guest-body {
    background:
        linear-gradient(135deg, rgba(18, 108, 87, .08), transparent 34%),
        linear-gradient(315deg, rgba(183, 122, 32, .10), transparent 35%),
        #f4f7f3;
}

.guest-body .shell {
    width: min(100% - 28px, 1180px);
    margin: 0 auto;
}

a {
    color: var(--primary);
    text-decoration: none;
}

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

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 20px;
    min-height: 68px;
    padding: 0 28px;
    background: rgba(255, 255, 255, .94);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-weight: 700;
    white-space: nowrap;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    font-size: 13px;
}

.nav {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    overflow-x: auto;
}

.nav a,
.icon-button {
    min-height: 38px;
    padding: 9px 12px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font: inherit;
    cursor: pointer;
    white-space: nowrap;
}

.nav a:hover,
.icon-button:hover {
    background: var(--surface-2);
    color: var(--text);
}

.logout {
    margin: 0;
}

.shell {
    width: min(1180px, calc(100% - 32px));
    margin: 28px auto 60px;
}

.auth-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
    gap: 36px;
    align-items: center;
    min-height: calc(100vh - 160px);
}

.auth-panel.wide {
    grid-template-columns: minmax(0, 360px) minmax(360px, 680px);
}

.auth-shell {
    display: grid;
    place-items: center;
    min-height: calc(100vh - 126px);
}

.auth-card {
    display: grid;
    grid-template-columns: minmax(0, .85fr) minmax(360px, .75fr);
    width: min(980px, 100%);
    overflow: hidden;
    border: 1px solid rgba(18, 108, 87, .16);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 28px 90px rgba(31, 44, 38, .14);
}

.auth-card.register-card {
    grid-template-columns: minmax(0, .8fr) minmax(520px, 1fr);
}

.auth-visual {
    position: relative;
    display: grid;
    align-content: space-between;
    min-height: 520px;
    padding: 34px;
    background:
        linear-gradient(180deg, rgba(18, 108, 87, .92), rgba(10, 47, 43, .96)),
        #123f36;
    color: #fff;
}

.auth-visual .eyebrow {
    color: #e2b35f;
}

.auth-visual h1 {
    max-width: 430px;
    margin-bottom: 14px;
    color: #fff;
    font-size: clamp(2.2rem, 4vw, 4.4rem);
}

.auth-visual p {
    max-width: 390px;
    color: rgba(255, 255, 255, .78);
}

.auth-visual img {
    width: min(360px, 82%);
    justify-self: center;
    margin: 12px 0;
    border-radius: 8px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .24);
}

.auth-stats {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 8px;
    background: rgba(255, 255, 255, .08);
}

.auth-stats span {
    color: rgba(255, 255, 255, .7);
    font-size: .86rem;
}

.auth-stats strong {
    color: #fff;
    font-size: 1.15rem;
    white-space: nowrap;
}

.auth-highlights {
    display: grid;
    gap: 10px;
}

.auth-highlights span {
    display: flex;
    align-items: center;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 8px;
    background: rgba(255, 255, 255, .08);
    color: rgba(255, 255, 255, .86);
    font-weight: 700;
}

.auth-form {
    display: grid;
    align-content: center;
    gap: 17px;
    padding: 42px;
}

.auth-form h2 {
    margin-bottom: 0;
    font-size: clamp(1.8rem, 3vw, 2.45rem);
    line-height: 1.05;
}

.simple-auth {
    display: grid;
    place-items: start center;
    min-height: 100vh;
    padding: 54px 0;
}

.simple-auth-form {
    display: grid;
    gap: 18px;
    width: min(100%, 430px);
    padding: 30px;
    border: 1px solid rgba(18, 108, 87, .14);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 20px 70px rgba(31, 44, 38, .12);
}

.simple-auth-form-wide {
    width: min(100%, 720px);
}

.simple-auth-head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 4px;
}

.simple-auth-head .eyebrow {
    margin-bottom: 4px;
}

.simple-auth-head h1 {
    margin: 0;
    font-size: clamp(1.9rem, 4vw, 2.55rem);
}

.simple-auth-form input,
.simple-auth-form select {
    min-height: 50px;
    background: #fbfaf7;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 10px;
    font-size: clamp(2rem, 5vw, 4.2rem);
    line-height: 1;
}

h2 {
    font-size: 1.25rem;
}

.eyebrow {
    margin-bottom: 12px;
    color: var(--accent);
    font-size: .76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0;
}

.muted {
    color: var(--muted);
}

.form-card,
.metric,
.product-card,
.referral-box,
.table-wrap {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.form-card {
    display: grid;
    gap: 16px;
    padding: 22px;
}

.grid-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.span-2 {
    grid-column: span 2;
}

label {
    display: grid;
    gap: 7px;
    color: #3b3d3b;
    font-size: .92rem;
    font-weight: 700;
}

.auth-form label {
    color: #2f3733;
}

input,
select {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid #cfc7bd;
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    font: inherit;
}

input[type="file"] {
    padding: 11px;
    line-height: 1.2;
}

.auth-form input,
.auth-form select {
    min-height: 50px;
    background: #fbfaf7;
}

input:focus,
select:focus {
    border-color: var(--primary);
    outline: 3px solid rgba(18, 108, 87, .16);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: 8px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    text-align: center;
}

.button.primary {
    background: var(--primary);
    color: #fff;
}

.button.primary:hover {
    background: var(--primary-2);
}

.button.secondary {
    border-color: #b9c7c1;
    background: var(--surface-2);
    color: var(--primary-2);
}

.button.danger {
    border-color: rgba(166, 61, 64, .28);
    background: rgba(166, 61, 64, .08);
    color: var(--danger);
}

.button.tiny {
    min-height: 32px;
    padding: 6px 10px;
    font-size: .82rem;
}

.button.full {
    width: 100%;
}

.form-footer {
    margin-bottom: 0;
    color: var(--muted);
    text-align: center;
}

.page-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 22px;
}

.page-head h1 {
    margin-bottom: 0;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 5px 10px;
    border-radius: 999px;
    background: #ece6dc;
    color: #51493e;
    font-size: .82rem;
    font-weight: 700;
    white-space: nowrap;
}

.status-pill.approved,
.status-pill.active,
.status-pill.paid,
.status-pill.completed {
    background: rgba(32, 116, 77, .12);
    color: var(--success);
}

.status-pill.pending,
.status-pill.proof_sent {
    background: rgba(183, 122, 32, .14);
    color: #8b5b15;
}

.status-pill.rejected,
.status-pill.failed,
.status-pill.canceled {
    background: rgba(166, 61, 64, .12);
    color: var(--danger);
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}

.metric {
    min-height: 110px;
    padding: 18px;
}

.metric span {
    display: block;
    color: var(--muted);
    font-size: .86rem;
}

.metric strong {
    display: block;
    margin-top: 10px;
    font-size: clamp(1.25rem, 2vw, 1.8rem);
}

.notice,
.alert {
    margin-bottom: 20px;
    padding: 14px 16px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #fff8e8;
    color: #6a4a13;
}

.alert-success {
    background: #edf8f1;
    color: var(--success);
}

.alert-error {
    background: #fff0f0;
    color: var(--danger);
}

.split {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(340px, .9fr);
    gap: 20px;
    margin: 20px 0;
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 28px 0 12px;
}

.section-title h2 {
    margin-bottom: 0;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.product-grid.compact {
    grid-template-columns: repeat(3, minmax(190px, 1fr));
}

.product-card {
    overflow: hidden;
}

.product-card img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    background: #ebe7df;
}

.product-card > div {
    display: grid;
    gap: 12px;
    padding: 16px;
}

.product-card h2,
.product-card h3 {
    margin-bottom: 0;
}

.product-card p {
    min-height: 48px;
    margin-bottom: 0;
    color: var(--muted);
}

.product-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.product-meta span {
    color: var(--accent);
    font-size: .88rem;
    font-weight: 700;
}

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

.facts div {
    padding: 10px;
    border-radius: 8px;
    background: #f8f6f1;
}

.facts dt {
    color: var(--muted);
    font-size: .78rem;
}

.facts dd {
    margin: 2px 0 0;
    font-weight: 700;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

th {
    color: var(--muted);
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: 0;
}

tr:last-child td {
    border-bottom: 0;
}

.right {
    text-align: right;
}

.positive {
    color: var(--success);
    font-weight: 700;
}

.negative {
    color: var(--danger);
    font-weight: 700;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.actions form {
    margin: 0;
}

.checkout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
    gap: 26px;
    align-items: center;
    min-height: 420px;
}

.order-split {
    align-items: start;
}

.payment-card h2 {
    margin-bottom: 0;
}

.payment-data {
    display: grid;
    gap: 10px;
    margin: 0;
}

.payment-data div {
    padding: 11px 12px;
    border-radius: 8px;
    background: #f8f6f1;
}

.payment-data dt {
    color: var(--muted);
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
}

.payment-data dd {
    margin: 3px 0 0;
    overflow-wrap: anywhere;
    font-weight: 700;
}

.proof-form {
    display: grid;
    gap: 14px;
}

.success-notice {
    background: #edf8f1;
    color: var(--success);
}

.referral-box {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 18px;
    align-items: center;
    padding: 18px;
    margin-bottom: 20px;
}

.referral-box span {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: .82rem;
}

.referral-box strong {
    font-size: 1.8rem;
}

@media (max-width: 980px) {
    .topbar {
        flex-wrap: wrap;
        padding: 12px 16px;
    }

    .nav {
        order: 3;
        width: 100%;
        margin-left: 0;
    }

    .auth-panel,
    .auth-panel.wide,
    .auth-card,
    .auth-card.register-card,
    .split,
    .checkout {
        grid-template-columns: 1fr;
    }

    .auth-visual {
        min-height: 300px;
    }

    .auth-visual img {
        display: none;
    }

    .metric-grid,
    .product-grid,
    .product-grid.compact {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .shell {
        width: min(100% - 22px, 1180px);
        margin-top: 12px;
    }

    .guest-body .shell {
        width: min(100% - 22px, 1180px);
        margin: 0 auto;
    }

    h1 {
        font-size: 2rem;
    }

    .page-head {
        align-items: stretch;
        flex-direction: column;
    }

    .metric-grid,
    .product-grid,
    .product-grid.compact,
    .grid-form,
    .referral-box {
        grid-template-columns: 1fr;
    }

    .auth-form,
    .auth-visual {
        padding: 22px;
    }

    .auth-card,
    .auth-card.register-card {
        width: 100%;
    }

    .auth-visual {
        display: none;
    }

    .auth-shell {
        min-height: calc(100vh - 96px);
        place-items: start center;
    }

    .auth-form h2 {
        font-size: 1.75rem;
    }

    .auth-form input,
    .auth-form select {
        min-height: 52px;
        font-size: 16px;
    }

    .simple-auth {
        min-height: 100vh;
        padding: 18px 0 28px;
    }

    .simple-auth-form,
    .simple-auth-form-wide {
        width: 100%;
        padding: 22px;
    }

    .simple-auth-form input,
    .simple-auth-form select {
        min-height: 52px;
        font-size: 16px;
    }

    .button {
        min-height: 48px;
    }

    .span-2 {
        grid-column: span 1;
    }

    th,
    td {
        padding: 11px 10px;
    }
}

/* ===== Correcoes UX/mobile/admin - pacote revisado ===== */
.admin-head {
    align-items: center;
}

.admin-head .muted {
    margin: 6px 0 0;
}

.admin-metrics {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.admin-section {
    margin-top: 26px;
}

.button:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(31, 34, 32, .10);
}

.button:active {
    transform: translateY(0);
    box-shadow: none;
}

.table-wrap {
    width: 100%;
}

.responsive-table td,
.responsive-table th {
    overflow-wrap: anywhere;
}

.status-pill.waiting_proof {
    background: rgba(183, 122, 32, .14);
    color: #8b5b15;
}

@media (max-width: 1100px) {
    .admin-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .topbar {
        position: static;
        gap: 10px;
        padding: 12px;
    }

    .brand {
        flex: 1 1 auto;
    }

    .nav {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 8px;
        overflow: visible;
    }

    .nav a,
    .icon-button {
        min-height: 42px;
        padding: 8px;
        background: #f4f7f3;
        text-align: center;
        font-size: .86rem;
    }

    .logout {
        margin-left: auto;
    }

    .shell {
        width: min(100% - 20px, 1180px);
        margin: 14px auto 36px;
    }

    .metric-grid,
    .admin-metrics {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .metric {
        min-height: 92px;
        padding: 14px;
    }

    .metric strong {
        font-size: 1.25rem;
    }

    .product-card > div,
    .form-card {
        padding: 14px;
    }

    .product-card p {
        min-height: auto;
    }

    .facts {
        grid-template-columns: 1fr;
    }

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

    table.responsive-table,
    table.responsive-table thead,
    table.responsive-table tbody,
    table.responsive-table th,
    table.responsive-table td,
    table.responsive-table tr {
        display: block;
        width: 100%;
    }

    table.responsive-table thead {
        display: none;
    }

    table.responsive-table tr {
        margin-bottom: 12px;
        padding: 12px;
        border: 1px solid var(--line);
        border-radius: 12px;
        background: var(--surface);
        box-shadow: var(--shadow);
    }

    table.responsive-table td {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 14px;
        min-height: 42px;
        padding: 10px 0;
        border-bottom: 1px solid #eee7dd;
        text-align: right;
    }

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

    table.responsive-table td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: .78rem;
        font-weight: 700;
        text-transform: uppercase;
        text-align: left;
    }

    table.responsive-table tbody tr td[colspan] {
        display: block;
        text-align: left;
    }

    table.responsive-table tbody tr td[colspan]::before {
        display: none;
    }

    .actions {
        justify-content: flex-end;
    }

    .actions .button,
    .actions form,
    .actions form .button {
        width: 100%;
    }

    .payment-data div {
        padding: 10px;
    }
}

@media (max-width: 420px) {
    .metric-grid,
    .admin-metrics {
        grid-template-columns: 1fr;
    }

    .nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
