:root {
    --bg: #070b14;
    --bg-elevated: #0f172a;
    --bg-card: #111827;
    --bg-input: #0b1220;
    --border: #1e293b;
    --border-strong: #334155;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --primary: #10b981;
    --primary-hover: #059669;
    --accent: #38bdf8;
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.12);
    --warn: #f59e0b;
    --warn-bg: rgba(245, 158, 11, 0.14);
    --ok-bg: rgba(16, 185, 129, 0.14);
    --info-bg: rgba(56, 189, 248, 0.14);
    --radius: 14px;
    --shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}

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

body {
    margin: 0;
    font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}

.tabular {
    font-variant-numeric: tabular-nums;
}

.mono,
.mono-input,
code {
    font-family: ui-monospace, "Cascadia Mono", "Consolas", monospace;
}

code {
    background: var(--bg-input);
    border: 1px solid var(--border);
    padding: 0.15rem 0.4rem;
    border-radius: 6px;
    font-size: 0.85em;
    color: var(--accent);
}

h1, h2, h3 {
    margin: 0;
    font-weight: 700;
    letter-spacing: -0.02em;
}

h1 { font-size: 1.45rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }

p { margin: 0; }

.text-muted { color: var(--text-muted); font-size: 0.92rem; }
.link-inline { color: #fde68a; text-decoration: underline; font-weight: 600; }
.text-center { text-align: center; }
.mt-1 { margin-top: 0.35rem; }
.mt-2 { margin-top: 0.75rem; }
.mt-3 { margin-top: 1.25rem; }

.page-center {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: radial-gradient(circle at top, #0f172a 0%, #070b14 65%);
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.card-narrow {
    width: 100%;
    max-width: 440px;
}

.brand-header {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.brand-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--ok-bg);
    border: 1px solid rgba(16, 185, 129, 0.35);
    display: grid;
    place-items: center;
    font-size: 1.35rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.badge-success { background: var(--ok-bg); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.35); }
.badge-info { background: var(--info-bg); color: #7dd3fc; border: 1px solid rgba(56, 189, 248, 0.35); }
.badge-warn { background: var(--warn-bg); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.35); }
.badge-danger { background: var(--danger-bg); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.35); }
.badge-muted { background: rgba(148, 163, 184, 0.14); color: var(--text-muted); border: 1px solid var(--border-strong); }

.alert {
    padding: 0.8rem 1rem;
    border-radius: 10px;
    font-size: 0.9rem;
}

.alert-danger {
    background: var(--danger-bg);
    border: 1px solid rgba(239, 68, 68, 0.45);
    color: #fca5a5;
}

.form-stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.field label {
    font-size: 0.86rem;
    font-weight: 600;
    color: #cbd5e1;
}

.field input,
.field select,
.search-input {
    width: 100%;
    padding: 0.72rem 0.9rem;
    border-radius: 10px;
    border: 1px solid var(--border-strong);
    background: var(--bg-input);
    color: var(--text);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input:focus,
.field select:focus,
.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18);
}

.input-amount {
    font-size: 1.35rem !important;
    font-weight: 700;
}

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem;
}

.label-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.check-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.82rem;
    color: var(--text-muted);
    cursor: pointer;
}

.check-inline input {
    width: auto;
    accent-color: var(--primary);
}

.hint {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.68rem 1.05rem;
    border-radius: 10px;
    border: 1px solid transparent;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s ease, transform 0.08s ease, border-color 0.15s ease;
}

.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
    background: var(--primary);
    color: #032216;
}
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); color: #ecfdf5; }

.btn-ghost {
    background: rgba(148, 163, 184, 0.1);
    color: var(--text);
    border-color: var(--border-strong);
}
.btn-ghost:hover:not(:disabled) { background: rgba(148, 163, 184, 0.2); }

.btn-danger-soft {
    background: var(--danger-bg);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.35);
}
.btn-danger-soft:hover:not(:disabled) { background: rgba(239, 68, 68, 0.25); }

.btn-block { width: 100%; }
.btn-lg { padding: 0.85rem 1.25rem; font-size: 1rem; }
.btn-sm { padding: 0.4rem 0.72rem; font-size: 0.8rem; border-radius: 8px; }

.copy-group {
    display: flex;
    gap: 0.5rem;
}

.copy-group input {
    flex: 1;
    min-width: 0;
}

.mono-input {
    font-size: 0.82rem !important;
}

/* Admin Layout */
.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(11, 17, 32, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}

.topbar-inner {
    max-width: 1220px;
    margin: 0 auto;
    padding: 0.85rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, #10b981, #0ea5e9);
    color: #03151e;
    font-weight: 800;
    display: grid;
    place-items: center;
}

.sub-tag {
    display: block;
    font-size: 0.76rem;
    color: var(--text-muted);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.balance-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.42rem 0.8rem;
    border-radius: 999px;
    background: var(--bg-card);
    border: 1px solid var(--border-strong);
    font-size: 0.84rem;
}

.balance-label { color: var(--text-muted); }
.balance-sep { color: var(--border-strong); }

.admin-container {
    max-width: 1220px;
    margin: 0 auto;
    padding: 1.35rem 1.25rem 3rem;
}

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

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.stat-label { font-size: 0.82rem; color: var(--text-muted); }
.stat-value { font-size: 1.5rem; font-weight: 700; color: var(--text); }
.stat-sub { font-size: 0.78rem; color: var(--text-muted); }

.tabs-bar {
    display: flex;
    gap: 0.5rem;
    margin: 1.35rem 0 1.1rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.65rem;
    overflow-x: auto;
}

.tab-btn {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid transparent;
    padding: 0.55rem 0.95rem;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.tab-btn:hover { color: var(--text); background: rgba(148, 163, 184, 0.08); }
.tab-btn.is-active {
    background: var(--ok-bg);
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.35);
}

.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

.split-grid {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 1.2rem;
    align-items: start;
}

.quick-amounts {
    display: flex;
    gap: 0.45rem;
    flex-wrap: wrap;
    margin-top: 0.25rem;
}

.chip-btn {
    background: var(--bg-input);
    color: var(--text-muted);
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    padding: 0.3rem 0.7rem;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
}
.chip-btn:hover { border-color: var(--primary); color: var(--text); }

.mode-cards {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.mode-option {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    padding: 0.8rem 0.9rem;
    border-radius: 10px;
    border: 1px solid var(--border-strong);
    background: var(--bg-input);
    cursor: pointer;
}

.mode-option:has(input:checked) {
    border-color: var(--primary);
    background: rgba(16, 185, 129, 0.08);
}

.mode-option input {
    width: auto;
    margin-top: 0.2rem;
    accent-color: var(--primary);
}

.mode-option strong { display: block; font-size: 0.92rem; }
.mode-option span { display: block; font-size: 0.8rem; color: var(--text-muted); margin-top: 0.15rem; }

.sub-panel {
    padding: 0.95rem;
    border-radius: 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
}

.sub-panel-title {
    font-size: 0.88rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.empty-state {
    padding: 2.5rem 1rem;
    text-align: center;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.amount-big {
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--text);
}

.qr-frame {
    display: flex;
    justify-content: center;
    padding: 1rem;
    border-radius: 12px;
    background: #ffffff;
    border: 1px solid var(--border);
}

.qr-frame-dark {
    max-width: 240px;
    margin-left: auto;
    margin-right: auto;
}

.qr-img {
    display: block;
    width: 200px;
    height: 200px;
    image-rendering: pixelated;
}

.card-head-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.search-input {
    max-width: 300px;
}

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

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.87rem;
}

.data-table th,
.data-table td {
    text-align: left;
    padding: 0.75rem 0.65rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.data-table th {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.table-actions {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.diag-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.diag-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.7rem 0.85rem;
    border-radius: 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
}

.kv-list {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    font-size: 0.87rem;
}

.toast {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 60;
    padding: 0.78rem 1.1rem;
    border-radius: 10px;
    background: #064e3b;
    border: 1px solid #10b981;
    color: #ecfdf5;
    font-weight: 600;
    box-shadow: var(--shadow);
}

.toast.is-error {
    background: #7f1d1d;
    border-color: #ef4444;
    color: #fee2e2;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: rgba(2, 6, 23, 0.78);
    display: grid;
    place-items: center;
    padding: 1rem;
}

.modal-card {
    width: 100%;
    max-width: 440px;
    background: var(--bg-card);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    padding: 1.35rem;
    box-shadow: var(--shadow);
}

/* Public Checkout */
.checkout-body {
    min-height: 100vh;
    background: radial-gradient(circle at top, #13223a 0%, #070b14 70%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
}

.checkout-shell {
    width: 100%;
    max-width: 470px;
}

.checkout-card {
    background: var(--bg-card);
    border: 1px solid var(--border-strong);
    border-radius: 18px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.checkout-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.checkout-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
}

.dot-secure {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--primary);
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.2);
}

.checkout-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
}

.summary-label {
    display: block;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.summary-title {
    font-size: 1rem;
    word-break: break-word;
}

.summary-amount {
    text-align: right;
    flex-shrink: 0;
}

.pix-status-bar {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.6rem 0.85rem;
    border-radius: 10px;
    background: var(--info-bg);
    border: 1px solid rgba(56, 189, 248, 0.3);
    font-size: 0.85rem;
    font-weight: 600;
    color: #bae6fd;
    margin-bottom: 1rem;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--accent);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(1.3); }
}

.timer-pill {
    margin-left: auto;
    font-size: 0.78rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.65);
}

.copy-feedback {
    color: #34d399;
    font-weight: 600;
    font-size: 0.8rem;
}

.pix-steps {
    margin-top: 1rem;
    padding: 0.85rem 1rem;
    border-radius: 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    font-size: 0.84rem;
    color: var(--text-muted);
}

.pix-steps ol {
    margin: 0.4rem 0 0;
    padding-left: 1.2rem;
}

.state-box {
    text-align: center;
    padding: 1.25rem 0.5rem;
}

.status-icon {
    width: 56px;
    height: 56px;
    border-radius: 999px;
    margin: 0 auto 0.85rem;
    display: grid;
    place-items: center;
    font-size: 1.65rem;
    font-weight: 800;
}

.status-ok {
    background: var(--ok-bg);
    color: #34d399;
    border: 2px solid rgba(16, 185, 129, 0.45);
}

.status-warn {
    background: var(--warn-bg);
    color: #fbbf24;
    border: 2px solid rgba(245, 158, 11, 0.45);
}

.receipt-meta {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.8rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    font-size: 0.86rem;
}

.receipt-meta div {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
}

.checkout-footer {
    margin-top: 1.25rem;
    padding-top: 0.9rem;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 0.78rem;
    color: var(--text-muted);
}

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

@media (max-width: 560px) {
    .stats-grid { grid-template-columns: 1fr; }
    .field-row { grid-template-columns: 1fr; }
    .checkout-summary { flex-direction: column; align-items: flex-start; }
    .summary-amount { text-align: left; }
}
