:root {
    --bg: #0f1115;
    --surface: #181b22;
    --surface-2: #20242e;
    --text: #e9edf2;
    --muted: #9aa3b2;
    --accent: #4f8cff;
    --accent-2: #2f6fe0;
    --border: #2a2f3a;
    --ok: #36c275;
    --danger: #e5564b;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.brand { font-weight: 700; font-size: 16px; }

.profile-chip {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 13px;
}
.profile-chip .balance { color: var(--ok); font-weight: 600; }

.container { max-width: 640px; margin: 0 auto; padding: 16px; }

.page-title { font-size: 22px; margin: 8px 0 4px; }
.subtitle { color: var(--muted); margin: 0 0 16px; }

.cards { display: flex; flex-direction: column; gap: 12px; }

.card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    transition: border-color .15s, transform .05s;
}
.card:active { transform: scale(0.99); }
.card:hover { border-color: var(--accent); }
.card-icon { font-size: 28px; width: 40px; text-align: center; }
.card-body { flex: 1; }
.card-title { font-weight: 600; font-size: 16px; }
.card-desc { color: var(--muted); font-size: 13px; margin-top: 2px; }
.card-arrow { color: var(--muted); font-size: 20px; }

.bottom-actions { margin-top: 20px; display: flex; gap: 10px; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid var(--accent-2);
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    width: 100%;
}
.btn:active { transform: scale(0.99); }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn.secondary { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input, .field select {
    width: 100%;
    padding: 12px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    font-size: 16px;
}

.note { color: var(--muted); font-size: 13px; }
.back-link { display: inline-block; color: var(--muted); margin-bottom: 12px; font-size: 14px; }

.summary {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px 16px;
    margin: 14px 0;
}
.summary .row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 14px; }
.summary .row .k { color: var(--muted); }
.summary .row.total { font-weight: 700; font-size: 16px; border-top: 1px solid var(--border); margin-top: 6px; padding-top: 10px; }

.badge { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.code-box { background: #0b0d11; border: 1px solid var(--border); border-radius: 10px; padding: 12px; font-family: ui-monospace, monospace; white-space: pre-wrap; word-break: break-all; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip {
    padding: 8px 14px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: 14px;
}
.chip.active { background: var(--accent); border-color: var(--accent-2); color: #fff; }

.list { display: flex; flex-direction: column; gap: 10px; }
.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 16px;
}
.list-item:hover { border-color: var(--accent); }
.li-name { font-weight: 500; }
.li-price { color: var(--ok); font-weight: 600; }

.product-desc { color: var(--text); line-height: 1.5; margin: 8px 0 4px; white-space: pre-wrap; }

.errors { margin-bottom: 14px; }
.error-item {
    background: rgba(229, 86, 75, 0.12);
    border: 1px solid var(--danger);
    color: #ff9b92;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
    margin-bottom: 8px;
}

.result { text-align: center; padding: 24px 8px 8px; }
.result-icon { font-size: 48px; }
.result-msg { color: var(--muted); }
.result.fail .result-icon { filter: none; }

.status-box {
    display: flex; align-items: center; gap: 10px;
    margin-top: 16px; padding: 14px 16px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
    color: var(--muted); font-size: 14px;
}
.status-box.fail { border-color: var(--danger); color: #ff9b92; }
.spinner {
    width: 16px; height: 16px; border-radius: 50%;
    border: 2px solid var(--border); border-top-color: var(--accent);
    animation: spin 0.8s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.order { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.order-head { display: flex; align-items: center; justify-content: space-between; }
.order-meta { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-size: 13px; color: var(--muted); }
.order-status { color: var(--text); }
.order-date { margin-left: auto; }
.order .code-box { margin-top: 10px; }
