:root {
    --brand: #0ea371;
    --brand-600: #0b8a5f;
    --brand-50: #e7f7f0;
    --navy: #0b1730;
    --navy-2: #13244a;
    --ink: #0f172a;
    --muted: #64748b;
    --line: #e6eaf1;
    --bg: #f4f6fb;
    --card: #ffffff;
    --radius: 16px;
    --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .06);
    --sidebar-w: 260px;
}

* { -webkit-font-smoothing: antialiased; }
body { font-family: 'Inter', system-ui, sans-serif; background: var(--bg); color: var(--ink); font-size: .94rem; }
a { color: var(--brand-600); }
.text-muted { color: var(--muted) !important; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
    width: var(--sidebar-w); flex-shrink: 0; position: fixed; inset: 0 auto 0 0; z-index: 1040;
    background: radial-gradient(120% 60% at 0% 0%, #17305f 0%, var(--navy) 55%);
    color: #cbd5e1; display: flex; flex-direction: column; padding: 22px 16px; transition: transform .25s ease;
}
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; padding: 4px 10px 26px; font-weight: 800; font-size: 1.12rem; letter-spacing: -.01em; }
.brand small { display: block; font-size: .7rem; font-weight: 500; color: #8fa3c4; letter-spacing: .08em; text-transform: uppercase; }
.brand-logo { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 1.2rem;
    background: linear-gradient(135deg, #34d399, var(--brand)); box-shadow: 0 8px 20px rgba(16, 185, 129, .35); color: #fff; }
.side-nav { display: flex; flex-direction: column; gap: 4px; }
.side-nav a { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 12px; color: #b6c2d9; text-decoration: none; font-weight: 500; transition: all .15s; }
.side-nav a i { font-size: 1.05rem; opacity: .85; }
.side-nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.side-nav a.active { background: linear-gradient(90deg, rgba(52, 211, 153, .18), rgba(52, 211, 153, .04)); color: #fff; box-shadow: inset 3px 0 0 #34d399; }
.side-nav a.active i { color: #34d399; opacity: 1; }
.side-footer { margin-top: auto; padding: 10px; }
.api-pill { display: flex; align-items: center; gap: 8px; font-size: .8rem; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, .05); }
.api-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: #f87171; box-shadow: 0 0 0 4px rgba(248, 113, 113, .18); }
.api-pill.on .dot { background: #34d399; box-shadow: 0 0 0 4px rgba(52, 211, 153, .2); }

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; gap: 12px; padding: 14px 28px;
    background: rgba(244, 246, 251, .85); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.page-title { font-size: 1.2rem; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.content { padding: 26px 28px; flex: 1; }
.app-footer { padding: 16px 28px; color: var(--muted); font-size: .8rem; }
.btn-icon { width: 40px; height: 40px; border-radius: 12px; background: #fff; border: 1px solid var(--line); font-size: 1.3rem; display: grid; place-items: center; }
.user-chip { display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 5px 12px 5px 5px; line-height: 1.15; }
.user-chip strong { display: block; font-size: .85rem; }
.user-chip small { color: var(--muted); font-size: .72rem; }
.avatar { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; font-size: .8rem; color: #fff; background: linear-gradient(135deg, #6366f1, #0ea5e9); }
.sidebar-backdrop { display: none; }

@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: none; }
    .sidebar.open + .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(2, 6, 23, .45); z-index: 1030; }
    .main { margin-left: 0; }
    .topbar, .content { padding-left: 16px; padding-right: 16px; }
}

/* ---------- Components ---------- */
.card-x { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-x .card-head { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.card-x .card-head h2 { font-size: 1rem; font-weight: 700; margin: 0; }
.card-x .card-body-x { padding: 22px; }

.btn { border-radius: 12px; font-weight: 600; padding: .6rem 1.1rem; }
.btn-sm { border-radius: 10px; padding: .4rem .8rem; }
.btn-lg { padding: .85rem 1.4rem; border-radius: 14px; }
.btn-brand { background: linear-gradient(135deg, #10b981, var(--brand-600)); color: #fff; border: 0; box-shadow: 0 6px 16px rgba(14, 163, 113, .28); }
.btn-brand:hover, .btn-brand:focus { color: #fff; filter: brightness(1.06); box-shadow: 0 8px 22px rgba(14, 163, 113, .38); }
.btn-soft { background: #fff; border: 1px solid var(--line); color: var(--ink); }
.btn-soft:hover { background: #f8fafc; border-color: #d5dbe6; }

.form-label { font-weight: 600; font-size: .83rem; color: #334155; margin-bottom: .4rem; }
.form-control, .form-select { border-radius: 12px; border-color: #dbe1ea; padding: .65rem .9rem; }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(16, 185, 129, .14); }
.input-group-text { border-radius: 12px; background: #f8fafc; border-color: #dbe1ea; color: var(--muted); }
.input-lg-amount { font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; }

/* Stats */
.stat { padding: 20px; display: flex; gap: 16px; align-items: center; height: 100%; }
.stat-icon { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; font-size: 1.35rem; flex-shrink: 0; }
.stat-label { color: var(--muted); font-size: .8rem; font-weight: 500; }
.stat-value { font-size: 1.55rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.2; }
.tone-green { background: #e7f7f0; color: #059669; }
.tone-blue { background: #e8f0fe; color: #2563eb; }
.tone-amber { background: #fff4e0; color: #d97706; }
.tone-red { background: #fdecec; color: #dc2626; }

.hero { border-radius: 20px; padding: 26px 28px; color: #fff; position: relative; overflow: hidden;
    background: radial-gradient(90% 140% at 100% 0%, #1fbf8a 0%, #0b8a5f 45%, #0b3b4a 100%); box-shadow: 0 16px 36px rgba(11, 138, 95, .25); }
.hero::after { content: ''; position: absolute; right: -60px; bottom: -80px; width: 240px; height: 240px; border-radius: 50%; background: rgba(255, 255, 255, .08); }
.hero h2 { font-weight: 800; letter-spacing: -.02em; font-size: 1.5rem; }
.hero p { color: rgba(255, 255, 255, .8); margin: 0; }
.hero .btn-light { color: var(--brand-600); }

/* Tables */
.table-x { margin: 0; }
.table-x thead th { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; background: #f8fafc; border-bottom: 1px solid var(--line); padding: 12px 16px; white-space: nowrap; }
.table-x td { padding: 14px 16px; vertical-align: middle; border-color: var(--line); white-space: nowrap; }
.table-x tbody tr { transition: background .12s; }
.table-x tbody tr:hover { background: #f8fbff; }
.table-x .row-link { cursor: pointer; }
.cell-main { font-weight: 600; }
.cell-sub { color: var(--muted); font-size: .8rem; }
.mono { font-family: ui-monospace, 'SFMono-Regular', Consolas, monospace; font-size: .82rem; }

.badge-status { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; font-size: .76rem; font-weight: 600; white-space: nowrap; }
.badge-status-success { background: #e7f7f0; color: #047857; }
.badge-status-warning { background: #fff4e0; color: #b45309; }
.badge-status-danger { background: #fdecec; color: #b91c1c; }
.badge-status-secondary { background: #eef1f5; color: #475569; }
.badge-status-info { background: #e6f4fb; color: #0369a1; }
.badge-status-light { background: #f1f5f9; color: #64748b; }
.badge-status-dark { background: #e2e8f0; color: #1e293b; }

.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty i { font-size: 2.4rem; display: block; margin-bottom: 10px; color: #cbd5e1; }

/* Steps */
.steps { list-style: none; padding: 0; margin: 0; counter-reset: s; }
.steps li { position: relative; padding: 0 0 20px 48px; counter-increment: s; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; background: var(--brand-50); color: var(--brand-600); }
.steps li:not(:last-child)::after { content: ''; position: absolute; left: 15px; top: 36px; bottom: 4px; width: 2px; background: var(--line); }
.steps strong { display: block; }
.steps span { color: var(--muted); font-size: .85rem; }

/* Confirm (receipt) card */
.receipt { max-width: 560px; margin: 0 auto; }
.receipt-top { text-align: center; padding: 30px 24px 22px; border-bottom: 1px dashed #d5dbe6; }
.receipt-top .amount { font-size: 2.6rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.receiver-box { display: flex; align-items: center; gap: 14px; background: var(--brand-50); border: 1px solid #c6ecdc; border-radius: 14px; padding: 14px 16px; text-align: left; margin-top: 18px; }
.receiver-box .avatar { width: 46px; height: 46px; border-radius: 14px; font-size: 1rem; background: linear-gradient(135deg, #10b981, #0ea5e9); }
.receiver-box .name { font-weight: 800; font-size: 1.1rem; }
.kv { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid #f1f4f8; }
.kv:last-child { border-bottom: 0; }
.kv dt { color: var(--muted); font-weight: 500; }
.kv dd { margin: 0; font-weight: 600; text-align: right; word-break: break-all; }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid #f1f4f8; }
.timeline li:last-child { border-bottom: 0; }
.tl-dot { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; font-size: .9rem; }
pre.json { background: #0b1730; color: #d1fae5; border-radius: 12px; padding: 14px; font-size: .78rem; max-height: 320px; overflow: auto; margin: 8px 0 0; }

/* Login */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-art { background: radial-gradient(90% 90% at 10% 10%, #1b3b73 0%, #0b1730 60%); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-art::before { content: ''; position: absolute; width: 420px; height: 420px; right: -120px; top: 30%; border-radius: 50%; background: radial-gradient(circle, rgba(52, 211, 153, .35), transparent 70%); }
.auth-art h1 { font-size: 2.5rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; max-width: 460px; }
.auth-art h1 span { color: #34d399; }
.auth-art p { color: #a9b8d3; max-width: 420px; }
.auth-feature { display: flex; gap: 12px; align-items: center; color: #d6e0f0; margin-top: 12px; }
.auth-feature i { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: rgba(255, 255, 255, .08); color: #34d399; }
.auth-form { display: grid; place-items: center; padding: 32px 16px; background: #fff; }
.auth-form .inner { width: 100%; max-width: 380px; }
@media (max-width: 900px) { .auth { grid-template-columns: 1fr; } .auth-art { display: none; } }

.spinner-inline { width: 1rem; height: 1rem; border-width: .15em; }
