*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --brand:     #6C47FF;
    --brand-dk:  #5538DD;
    --green:     #22C55E;
    --yellow:    #F59E0B;
    --red:       #EF4444;
    --gray-50:   #F9FAFB;
    --gray-100:  #F3F4F6;
    --gray-200:  #E5E7EB;
    --gray-400:  #9CA3AF;
    --gray-600:  #4B5563;
    --gray-800:  #1F2937;
    --radius:    12px;
    --shadow:    0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
}

/* ---- Header ---- */
.header {
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
    position: sticky; top: 0; z-index: 100;
}
.header-inner {
    max-width: 1200px; margin: auto;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px; height: 60px;
}
.logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.1rem; }
.logo-icon { font-size: 1.4rem; }
.nav { display: flex; gap: 4px; }
.nav-link {
    padding: 6px 14px; border-radius: 8px; font-size: .875rem; font-weight: 500;
    color: var(--gray-600); text-decoration: none; transition: background .15s;
}
.nav-link:hover { background: var(--gray-100); }
.nav-link.active { background: var(--brand); color: #fff; }

/* ---- Layout ---- */
.app-wrapper { min-height: 100vh; }
.main { max-width: 1200px; margin: auto; padding: 32px 24px 64px; }
.page-header { margin-bottom: 28px; }
.page-header h1 { font-size: 1.6rem; font-weight: 700; margin-bottom: 4px; }
.page-header p  { color: var(--gray-600); }

/* ---- Card ---- */
.card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px;
    margin-bottom: 20px;
}

/* ---- Alert ---- */
.alert {
    padding: 14px 18px; border-radius: var(--radius);
    margin-bottom: 20px; font-size: .9rem; font-weight: 500;
}
.alert-error   { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }
.alert-success { background: #F0FDF4; color: #14532D; border: 1px solid #BBF7D0; }

/* ---- Form ---- */
.form-section { margin-bottom: 32px; }
.form-section:last-of-type { margin-bottom: 0; }
.section-title {
    display: flex; align-items: center; gap: 10px;
    font-size: 1rem; font-weight: 600; margin-bottom: 20px;
    padding-bottom: 12px; border-bottom: 1px solid var(--gray-100);
}
.section-num {
    width: 26px; height: 26px; border-radius: 50%;
    background: var(--brand); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: .8rem; font-weight: 700; flex-shrink: 0;
}
.form-grid {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px;
}
@media(max-width: 600px) { .form-grid { grid-template-columns: 1fr; } }
.field.field-wide { grid-column: 1 / -1; }

.field label {
    display: block; font-size: .82rem; font-weight: 600;
    color: var(--gray-600); margin-bottom: 6px;
}
.field input, .field select {
    width: 100%; padding: 10px 14px; border-radius: 8px;
    border: 1.5px solid var(--gray-200); font-size: .95rem;
    font-family: inherit; transition: border-color .15s;
    background: #fff; color: var(--gray-800);
}
.field input:focus, .field select:focus {
    outline: none; border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(108,71,255,.15);
}
.input-prefix { position: relative; }
.input-prefix span {
    position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
    color: var(--gray-600); font-size: .9rem; font-weight: 600; pointer-events: none;
}
.input-prefix input { padding-left: 36px; }

/* ---- Payment options ---- */
.payment-options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
@media(max-width: 500px) { .payment-options { grid-template-columns: 1fr; } }
.payment-card { cursor: pointer; }
.payment-card input[type=radio] { display: none; }
.payment-card-inner {
    display: flex; align-items: center; gap: 14px;
    padding: 16px 18px; border-radius: var(--radius);
    border: 2px solid var(--gray-200); transition: border-color .15s, background .15s;
    position: relative;
}
.payment-card-inner strong { display: block; font-size: .95rem; }
.payment-card-inner small  { font-size: .8rem; color: var(--gray-600); }
.payment-icon { font-size: 1.8rem; }
.check-badge {
    position: absolute; top: 10px; right: 12px;
    width: 22px; height: 22px; border-radius: 50%;
    background: var(--brand); color: #fff;
    display: none; align-items: center; justify-content: center;
    font-size: .75rem; font-weight: 700;
}
.payment-card input:checked + .payment-card-inner {
    border-color: var(--brand); background: rgba(108,71,255,.04);
}
.payment-card input:checked + .payment-card-inner .check-badge { display: flex; }

/* ---- Buttons ---- */
.form-footer { margin-top: 28px; display: flex; justify-content: flex-end; }
.btn-primary {
    display: inline-flex; align-items: center; gap: 10px;
    background: var(--brand); color: #fff;
    padding: 12px 28px; border-radius: 10px; font-size: .95rem; font-weight: 600;
    border: none; cursor: pointer; text-decoration: none;
    transition: background .15s, transform .1s;
}
.btn-primary:hover { background: var(--brand-dk); }
.btn-primary:active { transform: scale(.98); }
.btn-primary.btn-block { width: 100%; justify-content: center; }
.btn-outline {
    display: inline-flex; align-items: center;
    border: 1.5px solid var(--gray-200); background: #fff; color: var(--gray-800);
    padding: 10px 22px; border-radius: 10px; font-size: .9rem; font-weight: 500;
    cursor: pointer; text-decoration: none; transition: border-color .15s;
}
.btn-outline:hover { border-color: var(--brand); color: var(--brand); }
.btn-sm {
    display: inline-block; padding: 4px 12px; border-radius: 6px;
    background: var(--gray-100); color: var(--gray-800);
    font-size: .8rem; font-weight: 500; text-decoration: none;
    border: 1px solid var(--gray-200); white-space: nowrap;
}
.btn-sm:hover { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn-sync { cursor: pointer; font-size: 1rem; padding: 4px 8px; color: var(--gray-600); }
.btn-sync:hover { background: #e0f2fe; color: #0369a1; border-color: #7dd3fc; }
.btn-sync:disabled { opacity: .5; cursor: not-allowed; }

/* ---- Resultado ---- */
.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px; }
@media(max-width: 640px) { .result-grid { grid-template-columns: 1fr; } }
.result-summary h2, .result-payment h2 { font-size: 1rem; font-weight: 700; margin-bottom: 18px; }
.summary-list { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; }
.summary-list dt { color: var(--gray-600); font-size: .85rem; font-weight: 500; white-space: nowrap; }
.summary-list dd { font-size: .9rem; }
.valor-destaque { font-size: 1.2rem; font-weight: 700; color: var(--brand); }
.qr-wrapper { display: flex; justify-content: center; margin: 16px 0; }
.qr-image { width: 200px; height: 200px; border-radius: 8px; border: 1px solid var(--gray-200); }
.copy-field { margin-bottom: 16px; }
.copy-field label { display: block; font-size: .82rem; font-weight: 600; color: var(--gray-600); margin-bottom: 6px; }
.copy-box { display: flex; gap: 8px; }
.copy-box input {
    flex: 1; padding: 9px 12px; border: 1.5px solid var(--gray-200);
    border-radius: 8px; font-size: .82rem; background: var(--gray-50); color: var(--gray-800);
    min-width: 0;
}
.btn-copy {
    padding: 9px 14px; background: var(--brand); color: #fff;
    border: none; border-radius: 8px; font-size: .82rem; font-weight: 600;
    cursor: pointer; white-space: nowrap; transition: background .15s;
}
.btn-copy:hover { background: var(--brand-dk); }
.result-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.info-msg { color: var(--gray-600); font-size: .9rem; margin-top: 8px; }

/* ---- Stats ---- */
.stats-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; margin-bottom: 20px; }
@media(max-width: 600px) { .stats-grid { grid-template-columns: 1fr; } }
.stat-card {
    background: #fff; border: 1px solid var(--gray-200);
    border-radius: var(--radius); padding: 20px 22px;
    box-shadow: var(--shadow);
}
.stat-card.stat-green { border-left: 4px solid var(--green); }
.stat-card.stat-yellow { border-left: 4px solid var(--yellow); }
.stat-label { display: block; font-size: .8rem; color: var(--gray-600); font-weight: 500; margin-bottom: 6px; }
.stat-value { display: block; font-size: 1.4rem; font-weight: 700; color: var(--gray-800); }

/* ---- Filters ---- */
.filters {
    display: flex; gap: 10px; flex-wrap: wrap;
    padding: 16px 20px; align-items: center;
}
.filters input, .filters select {
    padding: 8px 12px; border: 1.5px solid var(--gray-200);
    border-radius: 8px; font-size: .88rem; font-family: inherit;
    color: var(--gray-800); background: #fff; flex: 1; min-width: 140px;
}
.filters input:focus, .filters select:focus { outline: none; border-color: var(--brand); }

/* ---- Table ---- */
.table-card { padding: 0; overflow: hidden; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
thead th {
    background: var(--gray-50); padding: 12px 16px;
    text-align: left; font-weight: 600; font-size: .8rem;
    color: var(--gray-600); border-bottom: 1px solid var(--gray-200);
    white-space: nowrap;
}
tbody td { padding: 12px 16px; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--gray-50); }
.valor-col { font-weight: 600; white-space: nowrap; }
.actions-col { white-space: nowrap; width: 1%; }
.empty-msg { padding: 40px; text-align: center; color: var(--gray-600); }

/* ---- Badges / Tags ---- */
.badge {
    display: inline-block; padding: 3px 10px; border-radius: 20px;
    font-size: .75rem; font-weight: 600;
}
.badge-pending  { background: #FEF9C3; color: #854D0E; }
.badge-approved { background: #DCFCE7; color: #14532D; }
.badge-rejected { background: #FEE2E2; color: #991B1B; }
.badge-cancelled{ background: var(--gray-100); color: var(--gray-600); }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: .75rem; font-weight: 700; }
.tag-pix    { background: #EDE9FE; color: #5B21B6; }
.tag-boleto { background: #DBEAFE; color: #1E40AF; }

/* ---- Spinner ---- */
.spinner {
    width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.4);
    border-top-color: #fff; border-radius: 50%; animation: spin .6s linear infinite;
}
.hidden { display: none !important; }
@keyframes spin { to { transform: rotate(360deg); } }
