:root {
    --green-950: #03281e;
    --green-900: #073d2d;
    --green-800: #0b5038;
    --green-700: #0f6b46;
    --green-600: #159957;
    --green-100: #e8f5ef;
    --bg: #f4f6f8;
    --surface: #ffffff;
    --surface-soft: #fbfcfd;
    --text: #17202a;
    --muted: #64748b;
    --border: #e5e7eb;
    --danger: #b91c1c;
    --shadow: 0 2px 18px rgba(15, 23, 42, .08);
    --radius: 16px;
}

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-size: 16px;
}

button,
input,
select,
textarea {
    font: inherit;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--green-900);
    box-shadow: 0 2px 10px rgba(0, 0, 0, .14);
}

.navbar {
    max-width: 1100px;
    margin: 0 auto;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand {
    color: white;
    text-decoration: none;
    font-weight: 900;
    font-size: 20px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.brand-mark {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: rgba(255, 255, 255, .14);
}

.nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.nav-links a {
    color: white;
    text-decoration: none;
    font-weight: 800;
    opacity: .94;
    padding: 8px 10px;
    border-radius: 999px;
}

.nav-links a:hover,
.brand:hover {
    opacity: .82;
}

.nav-links a:hover {
    background: rgba(255, 255, 255, .12);
}

.page {
    padding: 28px 14px;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    background: var(--surface);
    padding: 28px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.footer {
    text-align: center;
    padding: 22px 16px;
    color: var(--muted);
}

h1 {
    margin: 0 0 12px;
    font-size: clamp(30px, 5vw, 38px);
    line-height: 1.12;
    letter-spacing: -.02em;
}

h2 {
    margin-top: 0;
    font-size: clamp(22px, 4vw, 28px);
    line-height: 1.18;
}

p {
    line-height: 1.55;
}

.eyebrow {
    color: var(--green-700);
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .08em;
    margin: 0 0 8px;
    font-size: 13px;
}

.hero {
    padding: 22px 0 18px;
}

.hero-text {
    max-width: 680px;
    color: var(--muted);
    font-size: clamp(17px, 4vw, 19px);
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin: 18px 0;
}

.button,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    background: var(--green-600);
    color: white;
    border: 0;
    padding: 12px 18px;
    border-radius: 12px;
    text-decoration: none;
    cursor: pointer;
    font-weight: 900;
    font-size: 16px;
    line-height: 1.2;
    touch-action: manipulation;
}

.button:hover,
button:hover {
    filter: brightness(.95);
}

.button.secondary {
    background: var(--green-100);
    color: var(--green-950);
}

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

.card,
.summary-card,
.form-card,
.wallet-header,
.hint,
.alert {
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px;
    background: var(--surface);
}

.card {
    background: var(--surface-soft);
}

.step-card {
    display: flex;
    gap: 14px;
}

.step-number {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--green-100);
    color: var(--green-900);
    font-weight: 900;
}

.card a {
    color: var(--green-700);
    font-weight: 900;
    text-decoration: none;
}

.page-title {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-top: 14px;
    font-weight: 900;
}

input {
    width: 100%;
    min-height: 48px;
    padding: 13px 14px;
    margin-top: 6px;
    box-sizing: border-box;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    font-size: 16px;
    background: #fff;
}

input:focus {
    outline: 3px solid rgba(21, 153, 87, .16);
    border-color: var(--green-600);
}

.form-card {
    max-width: 560px;
    background: var(--surface-soft);
}

.form-card button {
    margin-top: 18px;
}

.compact-form {
    max-width: 420px;
}

.hint {
    margin-top: 16px;
    color: var(--muted);
    background: #f8fafc;
}

.alert.danger {
    margin-bottom: 16px;
    background: #fef2f2;
    border-color: #fecaca;
    color: var(--danger);
}

.alert p {
    margin: 0;
}

.wallet-header {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: center;
    background: var(--surface-soft);
}

.balance-box {
    min-width: 220px;
    padding: 18px;
    border-radius: 14px;
    background: var(--green-900);
    color: white;
    text-align: right;
}

.balance-box span {
    display: block;
    opacity: .82;
    margin-bottom: 6px;
}

.balance-box strong {
    font-size: clamp(28px, 7vw, 34px);
    line-height: 1;
}

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

.summary-row:last-of-type {
    border-bottom: 0;
}

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

.table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
}

th,
td {
    border-bottom: 1px solid var(--border);
    padding: 12px 10px;
    text-align: left;
    vertical-align: top;
}

th {
    background: #f8fafc;
}

.mobile-bottom-nav {
    display: none;
}

@media (max-width: 820px) {
    .navbar {
        align-items: flex-start;
        flex-direction: column;
        padding: 12px 14px;
    }

    .nav-links {
        width: 100%;
        overflow-x: auto;
        flex-wrap: nowrap;
        justify-content: flex-start;
        padding-bottom: 2px;
        scrollbar-width: none;
    }

    .nav-links::-webkit-scrollbar {
        display: none;
    }

    .nav-links a {
        white-space: nowrap;
        background: rgba(255, 255, 255, .1);
        padding: 9px 12px;
    }

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

    .wallet-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .balance-box {
        width: 100%;
        text-align: left;
    }
}

@media (max-width: 560px) {
    body {
        padding-bottom: 78px;
    }

    .topbar {
        position: static;
    }

    .navbar {
        padding: 12px;
    }

    .brand {
        font-size: 18px;
    }

    .nav-links {
        display: none;
    }

    .page {
        padding: 12px;
    }

    .container {
        padding: 18px;
        border-radius: 18px;
    }

    .hero {
        padding-top: 10px;
    }

    .actions,
    .actions-main {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .button,
    button {
        width: 100%;
        min-height: 50px;
    }

    .card,
    .summary-card,
    .form-card,
    .wallet-header,
    .hint,
    .alert {
        padding: 16px;
    }

    .step-card {
        gap: 12px;
    }

    .step-card h2 {
        margin-bottom: 8px;
    }

    .mobile-form {
        max-width: none;
    }

    input {
        min-height: 52px;
        font-size: 16px;
    }

    .summary-row {
        flex-direction: column;
        gap: 4px;
    }

    .table-wrapper {
        overflow: visible;
    }

    table,
    thead,
    tbody,
    th,
    td,
    tr {
        display: block;
    }

    thead {
        display: none;
    }

    tr {
        border: 1px solid var(--border);
        border-radius: 14px;
        margin: 0 0 12px;
        padding: 10px 12px;
        background: var(--surface-soft);
    }

    td {
        border-bottom: 1px solid var(--border);
        padding: 10px 0;
        display: flex;
        justify-content: space-between;
        gap: 12px;
        text-align: right;
    }

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

    td::before {
        content: attr(data-label);
        font-weight: 900;
        color: var(--muted);
        text-align: left;
    }

    .footer {
        padding-bottom: 16px;
    }

    .mobile-bottom-nav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 50;
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 2px;
        padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
        background: rgba(3, 40, 30, .98);
        box-shadow: 0 -4px 18px rgba(15, 23, 42, .2);
    }

    .mobile-bottom-nav a {
        color: white;
        text-decoration: none;
        font-size: 12px;
        font-weight: 800;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-direction: column;
        gap: 3px;
        min-height: 52px;
        border-radius: 14px;
    }

    .mobile-bottom-nav a:active,
    .mobile-bottom-nav a:hover {
        background: rgba(255, 255, 255, .12);
    }

    .mobile-bottom-nav span {
        font-size: 18px;
        line-height: 1;
    }
}

.quick-values {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.quick-value {
    min-height: 42px;
    padding: 10px;
    background: var(--green-100);
    color: var(--green-950);
}

.divider-text {
    margin: 16px 0 2px;
    color: var(--muted);
    font-weight: 900;
    text-align: center;
}

.hint.success,
.success {
    border-color: #bbf7d0;
    background: #f0fdf4;
    color: #166534;
}

.admin-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin: 18px 0;
}

.stat-card {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-soft);
    padding: 18px;
}

.stat-card span {
    display: block;
    color: var(--muted);
    font-weight: 800;
    margin-bottom: 8px;
}

.stat-card strong {
    font-size: clamp(24px, 5vw, 34px);
    line-height: 1;
}

.admin-search {
    margin-bottom: 18px;
}

.inline-credit-form {
    display: grid;
    gap: 8px;
    min-width: 260px;
}

.inline-credit-form input {
    min-height: 42px;
    margin-top: 0;
}

.inline-credit-form button {
    min-height: 42px;
    padding: 9px 12px;
}

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

@media (max-width: 560px) {
    .quick-values {
        grid-template-columns: 1fr;
    }

    .admin-stats {
        grid-template-columns: 1fr;
    }

    .inline-credit-form {
        width: 100%;
        min-width: 0;
    }
}

.status-line {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 7px 12px;
    border-radius: 999px;
    font-weight: 900;
    background: #fef3c7;
    color: #92400e;
}

.status-badge.success,
.alert.success {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #166534;
}

.status-badge.danger {
    background: #fef2f2;
    color: #b91c1c;
}

.pix-box {
    display: grid;
    gap: 14px;
    margin: 18px 0;
    padding: 18px;
    border: 1px dashed #86efac;
    border-radius: 16px;
    background: #f7fef9;
}

.pix-qrcode {
    width: min(260px, 100%);
    height: auto;
    display: block;
    margin: 0 auto;
    border-radius: 14px;
    background: white;
    border: 1px solid var(--border);
    padding: 10px;
}

textarea {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    padding: 12px;
    resize: vertical;
    font-family: Consolas, 'Courier New', monospace;
    font-size: 14px;
    background: white;
}

.inline-form {
    margin: 0;
    display: inline-flex;
}

.admin-actions {
    align-items: stretch;
}

.admin-search {
    margin-bottom: 18px;
}

.stat-card span {
    display: block;
    color: var(--muted);
    font-weight: 800;
    margin-bottom: 8px;
}

.stat-card strong {
    display: block;
    font-size: clamp(22px, 5vw, 30px);
    line-height: 1.1;
}

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

@media (max-width: 560px) {
    .admin-stats {
        grid-template-columns: 1fr;
    }

    .inline-form,
    .inline-form button {
        width: 100%;
    }

    .pix-box {
        padding: 14px;
    }
}
