:root {
    --ink: #111827;
    --muted: #687386;
    --line: #e5eaf2;
    --panel: #ffffff;
    --page: #f4f7fb;
    --blue: #155eef;
    --green: #16a34a;
    --yellow: #facc15;
    --red: #dc2626;
}

* { box-sizing: border-box; }

body {
    min-height: 100vh;
    margin: 0;
    background: var(--page);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0;
}

.app-nav {
    background: #101828;
    box-shadow: 0 12px 30px rgba(16, 24, 40, .16);
}

.navbar-brand,
.app-nav .nav-link {
    color: #fff;
}

.app-nav .nav-link:hover,
.navbar-brand:hover {
    color: #dbeafe;
}

.app-shell {
    padding: 30px 0 46px;
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        linear-gradient(125deg, rgba(21, 94, 239, .10), rgba(22, 163, 74, .08)),
        #f6f8fc;
}

.auth-card,
.panel,
.table-wrap,
.metric,
.quick-action {
    background: var(--panel);
    border: 1px solid var(--line);
    box-shadow: 0 18px 50px rgba(16, 24, 40, .08);
}

.auth-card {
    width: min(100%, 460px);
    border-radius: 8px;
    padding: 34px;
}

.auth-card-wide {
    width: min(100%, 540px);
}

.panel {
    border-radius: 8px;
    padding: 24px;
}

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

.page-head h1,
.auth-card h1 {
    font-size: clamp(28px, 4vw, 42px);
    line-height: 1.05;
    margin: 0;
    letter-spacing: 0;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--blue);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

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

.metric {
    border-radius: 8px;
    padding: 20px;
}

.metric span,
.quick-action span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.metric strong {
    display: block;
    margin-top: 8px;
    font-size: 34px;
    line-height: 1;
}

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

.quick-action {
    border-radius: 8px;
    padding: 22px;
    color: var(--ink);
    text-decoration: none;
}

.quick-action strong {
    display: block;
    margin-top: 8px;
    font-size: 18px;
}

.searchbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    margin-bottom: 14px;
}

.table-wrap {
    border-radius: 8px;
    overflow: auto;
}

.table {
    margin: 0;
    min-width: 860px;
}

.table thead th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .05em;
    background: #f8fafc;
    border-bottom: 1px solid var(--line);
}

.actions {
    white-space: nowrap;
}

.actions a,
.actions button {
    border: 0;
    background: transparent;
    color: var(--blue);
    font-weight: 700;
    text-decoration: none;
    margin-left: 12px;
    padding: 0;
}

.actions form {
    display: inline;
}

.actions button {
    color: var(--red);
}

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

.form-actions {
    grid-column: 1 / -1;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 6px;
}

.form-control,
.form-select,
.btn {
    border-radius: 6px;
    min-height: 42px;
}

.btn-primary {
    background: var(--blue);
    border-color: var(--blue);
}

.btn-whatsapp {
    background: #16a34a;
    border-color: #16a34a;
    color: #fff;
}

.btn-whatsapp:hover,
.btn-whatsapp:focus {
    background: #12843c;
    border-color: #12843c;
    color: #fff;
}

.status-pill,
.network-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 26px;
    border-radius: 999px;
    padding: 4px 11px;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.status-finished {
    background: #dcfce7;
    color: #166534;
}

.status-pending {
    background: #fef9c3;
    color: #854d0e;
}

.status-processing {
    background: #dbeafe;
    color: #1d4ed8;
}

.status-failed {
    background: #fee2e2;
    color: #991b1b;
}

.network-badge.bsc {
    background: var(--yellow);
    color: #1f2937;
}

.network-badge.trc20 {
    background: #ffe4e6;
    color: #be123c;
}

.network-badge.erc20 {
    background: #e0f2fe;
    color: #075985;
}

.preview-shell {
    min-height: calc(100vh - 78px);
    display: grid;
    place-items: center;
    padding: 28px;
}

.preview-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.payout-modal {
    position: relative;
    width: min(100%, 490px);
    background: #fff;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 24px 80px rgba(16, 24, 40, .18);
    border: 1px solid var(--line);
}

.payout-modal h2,
.receipt-card h2 {
    margin: 0;
    font-size: 26px;
    letter-spacing: 0;
}

.close-x {
    position: absolute;
    top: 16px;
    right: 18px;
    color: #98a2b3;
    font-size: 28px;
    line-height: 1;
}

.detail-row {
    display: grid;
    grid-template-columns: 132px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--line);
    padding: 14px 0;
}

.detail-row span,
.receipt-grid span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.detail-row strong,
.receipt-grid strong {
    min-width: 0;
    overflow-wrap: anywhere;
    font-size: 14px;
}

.toggle-secret {
    border: 0;
    background: #eef4ff;
    color: var(--blue);
    border-radius: 6px;
    padding: 6px 9px;
    font-size: 12px;
    font-weight: 800;
}

.ok-button {
    display: block;
    width: 94px;
    margin: 24px 0 0 auto;
    border: 0;
    border-radius: 6px;
    min-height: 42px;
    color: #fff;
    font-weight: 800;
    background: var(--blue);
}

.receipt-card {
    width: min(100%, 780px);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 24px 80px rgba(16, 24, 40, .16);
    padding: 34px;
}

.receipt-top {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 18px;
    border-bottom: 1px solid var(--line);
    padding-bottom: 22px;
    margin-bottom: 12px;
}

.receipt-top p {
    color: var(--muted);
    margin: 0 0 8px;
    font-size: 13px;
}

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

.receipt-grid > div {
    min-width: 0;
    border-bottom: 1px solid var(--line);
    padding: 17px 0;
}

.receipt-grid strong {
    display: block;
    margin-top: 6px;
}

.receipt-card footer {
    margin-top: 24px;
    color: var(--muted);
    font-size: 12px;
}

.error-box {
    background: #111827;
    color: #f8fafc;
    border-radius: 8px;
    padding: 16px;
    white-space: pre-wrap;
}

.panel-title {
    margin: 0 0 12px;
    font-size: 22px;
}

.credit-layout {
    display: grid;
    grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
    gap: 16px;
}

.wallet-box {
    border: 1px dashed var(--line);
    border-radius: 8px;
    padding: 14px;
    background: #f8fafc;
}

.wallet-box span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.wallet-box strong,
.hash-cell {
    overflow-wrap: anywhere;
}

.payment-qr {
    display: block;
    width: min(220px, 100%);
    margin-top: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
}

.review-form {
    display: grid;
    grid-template-columns: 120px 130px auto;
    gap: 8px;
    align-items: center;
    min-width: 360px;
}

.no-shadow {
    box-shadow: none;
}

.front-shell {
    min-height: 100vh;
    background: #07111f;
    color: #fff;
}

.front-hero {
    min-height: 82vh;
    padding: 22px clamp(18px, 5vw, 64px) 56px;
    background:
        linear-gradient(135deg, rgba(21, 94, 239, .42), rgba(22, 163, 74, .25)),
        radial-gradient(circle at 80% 20%, rgba(250, 204, 21, .16), transparent 32%),
        #07111f;
}

.front-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 64px;
}

.front-brand {
    color: #fff;
    font-size: 20px;
    font-weight: 900;
    text-decoration: none;
}

.front-nav > div,
.front-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.front-hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(320px, .9fr);
    gap: 34px;
    align-items: center;
}

.front-copy h1 {
    max-width: 900px;
    font-size: clamp(42px, 7vw, 78px);
    line-height: .96;
    letter-spacing: 0;
    margin: 0 0 20px;
}

.front-copy p:not(.eyebrow) {
    max-width: 680px;
    color: #d7e2f2;
    font-size: 18px;
}

.front-preview {
    display: grid;
    place-items: center;
}

.receipt-card-mini {
    width: min(100%, 410px);
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 8px;
    background: rgba(255, 255, 255, .96);
    color: var(--ink);
    padding: 24px;
    box-shadow: 0 30px 90px rgba(0, 0, 0, .28);
}

.receipt-card-mini > div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

.receipt-card-mini p {
    border-top: 1px solid var(--line);
    margin: 0;
    padding: 14px 0;
    color: var(--muted);
}

.receipt-card-mini b {
    color: var(--ink);
}

.front-section,
.front-rates {
    padding: 58px clamp(18px, 5vw, 64px);
    background: #f7f9fd;
    color: var(--ink);
}

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

.front-section h2,
.front-rates h2 {
    margin: 0;
    font-size: clamp(30px, 4vw, 48px);
    letter-spacing: 0;
}

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

.feature-grid article,
.rate-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 22px;
    box-shadow: 0 16px 40px rgba(16, 24, 40, .06);
}

.feature-grid strong {
    font-size: 18px;
}

.feature-grid p,
.rate-card p {
    color: var(--muted);
    margin: 8px 0 0;
}

.front-rates {
    display: grid;
    grid-template-columns: 1fr 260px 260px;
    gap: 16px;
    align-items: stretch;
}

.rate-card span {
    color: var(--blue);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.rate-card strong {
    display: block;
    font-size: 44px;
    line-height: 1;
    margin-top: 12px;
}

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

.support-list article {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
    background: #f8fafc;
}

.support-list article > div,
.support-admin-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: start;
}

.support-list p {
    color: var(--muted);
    margin: 10px 0 0;
}

.reply-box {
    background: #eef4ff;
    border-radius: 8px;
    padding: 10px;
    color: var(--ink) !important;
}

.support-admin-list {
    display: grid;
    gap: 14px;
}

.support-review-form {
    grid-template-columns: minmax(240px, 1fr) 140px auto;
}

@media (max-width: 900px) {
    .stats-grid,
    .quick-grid,
    .form-grid,
    .credit-layout,
    .receipt-grid,
    .front-hero-grid,
    .feature-grid,
    .front-rates {
        grid-template-columns: 1fr;
    }

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

    .front-section-head,
    .front-nav {
        align-items: stretch;
        flex-direction: column;
    }
}

@media (max-width: 560px) {
    .auth-card,
    .panel,
    .payout-modal,
    .receipt-card {
        padding: 22px;
    }

    .detail-row {
        grid-template-columns: 1fr;
        gap: 6px;
    }

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

    .support-review-form,
    .review-form {
        grid-template-columns: 1fr;
        min-width: 0;
    }
}

@media print {
    body {
        background: #fff;
    }

    .app-nav,
    .no-print {
        display: none !important;
    }

    .preview-shell {
        display: block;
        padding: 0;
        min-height: 0;
    }

    .printable {
        box-shadow: none;
        width: 100%;
        border: 0;
    }
}
