/* PKPay / RastQR gateway: admin panel, merchant portal, checkout, docs (no build step) */

:root {
    --bg: #f4f6fb;
    --surface: #ffffff;
    --surface-2: #f8f9fc;
    --text: #0f172a;
    --text-2: #334155;
    --muted: #64748b;
    --border: #e5e8f0;
    --border-strong: #d3d8e4;

    --primary: #4f46e5;
    --primary-strong: #4338ca;
    --primary-soft: #eef2ff;
    --primary-ring: rgba(79, 70, 229, .18);
    --accent: #0ea5a4;

    --success: #047857;
    --success-soft: #ecfdf5;
    --success-border: #a7f3d0;
    --warning: #b45309;
    --warning-soft: #fffbeb;
    --warning-border: #fcd34d;
    --danger: #be123c;
    --danger-soft: #fff1f2;
    --danger-border: #fecdd3;
    --info: #0369a1;
    --info-soft: #f0f9ff;
    --info-border: #bae6fd;
    --neutral-soft: #f1f5f9;

    --sidebar: linear-gradient(180deg, #0f172a 0%, #1e1b4b 100%);
    --sidebar-text: #c7cee0;
    --sidebar-muted: #7d88a8;
    --brand-gradient: linear-gradient(135deg, #6366f1 0%, #4f46e5 45%, #0ea5a4 100%);

    --radius: 14px;
    --radius-sm: 10px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
    --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 8px 24px -12px rgba(15, 23, 42, .12);
    --shadow-lg: 0 20px 50px -20px rgba(30, 27, 75, .35);
    --mono: ui-monospace, SFMono-Regular, "Cascadia Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
    background: var(--bg);
    color: var(--text);
    font: 14px/1.55 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-strong); text-decoration: underline; }

h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.25; color: var(--text); letter-spacing: -.01em; }
h1 { font-size: 1.5rem; font-weight: 700; }
h2 { font-size: 1.05rem; font-weight: 650; }
h3 { font-size: .92rem; font-weight: 650; }

p { margin: 0 0 .75rem; }

code, .mono { font-family: var(--mono); font-size: .88em; }

[hidden] { display: none !important; }

.icon { flex: none; vertical-align: middle; }

/* ---------- App layout (admin + merchant portal) ---------- */

.admin {
    display: grid;
    grid-template-columns: 248px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: var(--sidebar);
    color: var(--sidebar-text);
    padding: 1.25rem .85rem 1.1rem;
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.brand {
    display: flex;
    align-items: center;
    gap: .65rem;
    color: #fff;
    font-weight: 750;
    font-size: 1.08rem;
    letter-spacing: -.01em;
    padding: .1rem .55rem 1.35rem;
}

.brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--brand-gradient);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .04em;
    box-shadow: 0 6px 16px -6px rgba(99, 102, 241, .8);
}

.brand-sub { display: block; font-size: .72rem; font-weight: 500; color: var(--sidebar-muted); letter-spacing: 0; }

/* Mobile nav toggle (hamburger) — hidden on desktop, shown under 820px. */
.nav-toggle { display: none; }
.nav-burger { display: none; align-items: center; justify-content: center; margin-left: auto; cursor: pointer; color: #fff; font-size: 1.5rem; line-height: 1; padding: .1rem .45rem; border-radius: 8px; user-select: none; }
.nav-burger:hover { background: rgba(255, 255, 255, .1); }

.nav-section {
    font-size: .68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--sidebar-muted);
    padding: 1.1rem .65rem .4rem;
}

.nav {
    flex: 1 1 auto;
    overflow-y: auto;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .18) transparent;
}
.nav::-webkit-scrollbar { width: 6px; }
.nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .16); border-radius: 3px; }
.nav::-webkit-scrollbar-track { background: transparent; }

.nav a {
    position: relative;
    display: flex;
    align-items: center;
    gap: .65rem;
    color: var(--sidebar-text);
    padding: .52rem .65rem;
    border-radius: 9px;
    font-weight: 500;
    margin-bottom: 2px;
    white-space: nowrap;
    transition: background .15s, color .15s;
}
.nav-label { overflow: hidden; text-overflow: ellipsis; }

.nav a .icon { opacity: .75; }
.nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; text-decoration: none; }
.nav a:hover .icon { opacity: 1; }

.nav a.active {
    background: rgba(129, 140, 248, .18);
    color: #fff;
}

.nav a.active .icon { opacity: 1; color: #a5b4fc; }

.nav a.active::before {
    content: "";
    position: absolute;
    left: -.85rem;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: #818cf8;
}

.nav .nav-external { margin-left: auto; opacity: .5; }

/* Count badge on a nav item (e.g. pending payouts) */
.nav-badge {
    margin-left: auto;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: #f43f5e;
    color: #fff;
    font-size: .68rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px -2px rgba(244, 63, 94, .8);
}

/* Collapse / expand control pinned to the sidebar bottom */
.sidebar-toggle {
    flex: none;
    display: flex;
    align-items: center;
    gap: .65rem;
    width: 100%;
    margin-top: .6rem;
    padding: .55rem .65rem;
    border: 0;
    border-top: 1px solid rgba(255, 255, 255, .08);
    border-radius: 0;
    background: transparent;
    color: var(--sidebar-muted);
    font-weight: 500;
    font-size: .85rem;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.sidebar-toggle:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.sidebar-toggle-icon { font-size: 1.05rem; line-height: 1; transition: transform .2s; }

/* Collapsed (mini) sidebar — desktop only */
@media (min-width: 821px) {
    html.sidebar-collapsed .admin { grid-template-columns: 74px 1fr; }
    html.sidebar-collapsed .sidebar { padding-left: .5rem; padding-right: .5rem; }
    html.sidebar-collapsed .brand { justify-content: center; padding-left: 0; padding-right: 0; }
    html.sidebar-collapsed .brand-name { display: none; }
    html.sidebar-collapsed .nav a { justify-content: center; padding-left: 0; padding-right: 0; }
    html.sidebar-collapsed .nav-label,
    html.sidebar-collapsed .nav .nav-external { display: none; }
    html.sidebar-collapsed .nav a.active::before { left: -.5rem; }
    html.sidebar-collapsed .nav-section { font-size: 0; text-align: center; padding: .9rem 0 .35rem; }
    html.sidebar-collapsed .nav-section::after { content: "•••"; font-size: .6rem; letter-spacing: .1em; color: var(--sidebar-muted); }
    html.sidebar-collapsed .nav-badge {
        position: absolute; top: 3px; right: 5px; margin: 0;
        min-width: 15px; height: 15px; padding: 0 3px; font-size: .6rem;
    }
    html.sidebar-collapsed .sidebar-toggle { justify-content: center; }
    html.sidebar-collapsed .sidebar-toggle-icon { transform: rotate(180deg); }
}

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    min-height: 62px;
    padding: .7rem 2rem;
    background: rgba(255, 255, 255, .88);
    backdrop-filter: saturate(160%) blur(8px);
    border-bottom: 1px solid var(--border);
}

.topbar-title { font-weight: 650; color: var(--text-2); }

.topbar-user { display: flex; align-items: center; gap: .75rem; color: var(--muted); }

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    padding: .25rem .7rem .25rem .3rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-2);
    font-weight: 550;
}

.user-chip:hover { border-color: var(--border-strong); text-decoration: none; color: var(--text); }

.avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--brand-gradient);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: .72rem;
    font-weight: 700;
}

.content { padding: 1.75rem 2rem 3.5rem; max-width: 1320px; width: 100%; }

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.4rem;
    flex-wrap: wrap;
}

.page-head p { color: var(--muted); margin: .2rem 0 0; }

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

/* ---------- Cards & grids ---------- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1.4rem;
    overflow: hidden;
}

.card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.card-head h2 { margin: 0; font-size: 1rem; }
.card-body { padding: 1.25rem; }
.card-body > :last-child { margin-bottom: 0; }

.grid { display: grid; gap: 1.4rem; }
.grid > .card { margin-bottom: 0; }
.grid + .card, .grid + .grid { margin-top: 1.4rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.stat {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.1rem 1.25rem;
    overflow: hidden;
}

.stat::after {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 3px;
    background: var(--brand-gradient);
    opacity: .85;
}

.stat-label { color: var(--muted); font-size: .8rem; font-weight: 550; }
.stat-value { font-size: 1.7rem; font-weight: 750; margin-top: .3rem; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-note { color: var(--muted); font-size: .8rem; margin-top: .1rem; }

/* ---------- Tables ---------- */

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

table { width: 100%; border-collapse: collapse; }

th, td {
    text-align: left;
    padding: .72rem 1.25rem;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

th {
    background: var(--surface-2);
    color: var(--muted);
    font-size: .7rem;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: .06em;
    white-space: nowrap;
}

tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .12s; }
tbody tr:hover td { background: #fafbff; }

td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

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

.kv { display: grid; grid-template-columns: 170px 1fr; gap: .6rem 1rem; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; color: var(--text-2); }

/* ---------- Badges & alerts ---------- */

.badge {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .16rem .6rem;
    border-radius: 999px;
    font-size: .74rem;
    font-weight: 600;
    background: var(--neutral-soft);
    color: var(--muted);
    white-space: nowrap;
    border: 1px solid transparent;
}

.badge::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: .8;
}

.badge--paid, .badge--decoded, .badge--active, .badge--success { background: var(--success-soft); color: var(--success); border-color: var(--success-border); }
.badge--pending, .badge--warning { background: var(--warning-soft); color: var(--warning); border-color: var(--warning-border); }
.badge--failed, .badge--unsupported, .badge--danger, .badge--cancelled { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-border); }
.badge--expired, .badge--inactive { background: var(--neutral-soft); color: var(--muted); border-color: var(--border); }
.badge--info { background: var(--info-soft); color: var(--info); border-color: var(--info-border); }

.alert {
    padding: .85rem 1.05rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.25rem;
    border: 1px solid transparent;
    border-left-width: 4px;
}

.alert--success { background: var(--success-soft); color: #065f46; border-color: var(--success-border); border-left-color: var(--success); }
.alert--danger { background: var(--danger-soft); color: #9f1239; border-color: var(--danger-border); border-left-color: var(--danger); }
.alert--warning { background: var(--warning-soft); color: #92400e; border-color: var(--warning-border); border-left-color: var(--warning); }
.alert--info { background: var(--info-soft); color: #075985; border-color: var(--info-border); border-left-color: var(--info); }
.alert ul { margin: .25rem 0 0; padding-left: 1.2rem; }

.secret-box {
    font-family: var(--mono);
    background: #1e1b4b;
    color: #e0e7ff;
    padding: .75rem 1rem;
    border-radius: var(--radius-sm);
    word-break: break-all;
    margin: .5rem 0 .8rem;
    user-select: all;
    box-shadow: inset 0 0 0 1px rgba(165, 180, 252, .25);
}

/* ---------- Forms ---------- */

.form-row { margin-bottom: 1rem; }

label { display: block; font-weight: 600; margin-bottom: .35rem; color: var(--text-2); }

.hint { color: var(--muted); font-size: .8rem; margin-top: .3rem; font-weight: 400; }

input[type=text], input[type=email], input[type=password], input[type=number], input[type=url],
input[type=date], input[type=file], select, textarea {
    width: 100%;
    padding: .6rem .8rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--text);
    font: inherit;
    transition: border-color .15s, box-shadow .15s;
}

input:hover, select:hover, textarea:hover { border-color: #b8bfd0; }

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-ring);
}

input[type=file] { padding: .45rem .6rem; background: var(--surface-2); }

.checkbox { display: flex; align-items: center; gap: .55rem; font-weight: 550; }
.checkbox input { width: 16px; height: 16px; accent-color: var(--primary); }

.field-error { color: var(--danger); font-size: .8rem; margin-top: .25rem; }

.filters { display: flex; flex-wrap: wrap; gap: .65rem; align-items: flex-end; }
.filters .form-row { margin: 0; min-width: 150px; }
.filters label { font-size: .74rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

.fieldset { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1rem 1.1rem .25rem; margin: 0 0 1.1rem; background: var(--surface-2); }
.fieldset legend { font-weight: 700; padding: 0 .4rem; color: var(--text); }
textarea.mono { font-family: var(--mono); font-size: .85rem; }
details summary { cursor: pointer; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    padding: .55rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    background: #fff;
    color: var(--text-2);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: var(--shadow-sm);
    transition: background .15s, border-color .15s, box-shadow .15s, transform .05s;
}

.btn:hover { background: var(--surface-2); border-color: #b8bfd0; text-decoration: none; color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--primary-ring); }

.btn--primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: 0 6px 14px -6px rgba(79, 70, 229, .7);
}

.btn--primary:hover { background: var(--primary-strong); border-color: var(--primary-strong); color: #fff; }
.btn--danger { color: var(--danger); border-color: var(--danger-border); }
.btn--danger:hover { background: var(--danger-soft); color: var(--danger); border-color: #fda4af; }
.btn--sm { padding: .32rem .65rem; font-size: .8rem; }
.btn--block { width: 100%; }
.btn--ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--muted); }
.btn--ghost:hover { background: var(--neutral-soft); color: var(--text); border-color: transparent; }

.link-btn { background: none; border: 0; padding: 0; color: var(--primary); font: inherit; cursor: pointer; }

.tabs { display: flex; gap: .3rem; margin-bottom: 1.25rem; flex-wrap: wrap; padding: .3rem; background: var(--neutral-soft); border-radius: 12px; width: fit-content; }
.tabs a { padding: .45rem 1rem; color: var(--muted); font-weight: 600; border-radius: 9px; }
.tabs a.active { color: var(--primary); background: #fff; box-shadow: var(--shadow-sm); }
.tabs a:hover { text-decoration: none; color: var(--text); }

.pagination { display: flex; gap: .35rem; padding: 1rem 1.25rem; flex-wrap: wrap; align-items: center; border-top: 1px solid var(--border); }
.pagination .page { padding: .3rem .7rem; border: 1px solid var(--border); border-radius: 8px; color: var(--text-2); }
.pagination .page.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .page.disabled { color: #b5bdc7; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: .7rem 0 .7rem 1.1rem; border-left: 2px solid var(--primary-soft); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 1rem; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.timeline .time { color: var(--muted); font-size: .8rem; }

pre.json {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .7rem .85rem;
    font-size: .78rem;
    overflow-x: auto;
    margin: .4rem 0 0;
    max-height: 300px;
    color: var(--text-2);
}

.muted { color: var(--muted); }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }

.inline-form { display: inline; }

/* ---------- Payout mark-paid form ---------- */
/* In-flow (not absolute) so it is never clipped by the table's overflow. */

.payout-actions { display: inline-block; }
.payout-actions > summary { list-style: none; display: inline-flex; cursor: pointer; }
.payout-actions > summary::-webkit-details-marker { display: none; }
.payout-pop {
    margin: .5rem 0 .25rem auto;
    width: 230px;
    display: grid;
    gap: .5rem;
    padding: .75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-align: left;
    white-space: normal;
}
.payout-pop input { width: 100%; }

/* ---------- Merchant balance hero ---------- */

.balance-hero {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 1.5rem 1.75rem;
    border-radius: var(--radius);
    background: var(--brand-gradient);
    color: #fff;
    box-shadow: var(--shadow-lg);
    margin-bottom: 1.4rem;
}
.balance-label { color: rgba(255,255,255,.85); font-weight: 600; font-size: .85rem; }
.balance-value { font-size: 2.3rem; font-weight: 800; letter-spacing: -.02em; margin-top: .2rem; font-variant-numeric: tabular-nums; }
.balance-note { color: rgba(255,255,255,.8); font-size: .82rem; margin-top: .35rem; max-width: 30rem; }
.balance-side { display: grid; gap: .5rem; align-content: center; min-width: 190px; }
.balance-side > div { display: flex; justify-content: space-between; gap: 1.5rem; padding: .35rem .75rem; background: rgba(255,255,255,.12); border-radius: 8px; }
.balance-side-label { color: rgba(255,255,255,.85); font-size: .82rem; }
.balance-side-value { font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- Segmented choice (radio pills) ---------- */

.segmented { display: flex; flex-wrap: wrap; gap: .35rem; padding: .3rem; background: var(--neutral-soft); border-radius: 12px; }
.segmented label {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    margin: 0;
    padding: .45rem .85rem;
    border-radius: 9px;
    color: var(--muted);
    font-weight: 600;
    cursor: pointer;
}
.segmented label:hover { color: var(--text); }
.segmented label.active { background: #fff; color: var(--primary); box-shadow: var(--shadow-sm); }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label:focus-within { box-shadow: 0 0 0 3px var(--primary-ring); }

/* ---------- Decoded QR table ---------- */

.decoded-table td { vertical-align: middle; }
.decoded-table .decoded-sub td:first-child { padding-left: 2.2rem; }
.decoded-table .decoded-sub td { background: var(--surface-2); }
.decoded-table .decoded-missing td { opacity: .8; }
.decoded-table td:nth-child(3) { min-width: 300px; }
.decoded-table td:nth-child(5) { white-space: nowrap; }
.decoded-value { min-width: 230px; }
.decoded-value .mono { overflow-wrap: anywhere; }
.decoded-value input { width: 100%; min-width: 230px; }
.decoded-save { border-top: 1px solid var(--border); background: var(--surface-2); }

/* ---------- Auth (admin + merchant login) ---------- */

.auth-body { min-height: 100vh; background: var(--bg); }

.auth-split { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh; }

.auth-brand {
    position: relative;
    overflow: hidden;
    background: radial-gradient(1200px 600px at -10% -20%, rgba(14, 165, 164, .35), transparent 60%),
                radial-gradient(900px 500px at 120% 120%, rgba(99, 102, 241, .45), transparent 60%),
                linear-gradient(160deg, #0f172a 0%, #1e1b4b 100%);
    color: #e2e8f0;
    padding: 3rem 3.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.auth-brand .brand { padding: 0; font-size: 1.2rem; }
.auth-brand h1 { color: #fff; font-size: 2.1rem; line-height: 1.15; margin: 0 0 1rem; max-width: 26rem; letter-spacing: -.02em; }
.auth-brand p { color: #c7d2fe; max-width: 28rem; font-size: 1rem; }

.auth-points { list-style: none; padding: 0; margin: 2rem 0 0; display: grid; gap: .85rem; }
.auth-points li { display: flex; gap: .7rem; align-items: flex-start; color: #e0e7ff; }
.auth-points .icon { color: #5eead4; margin-top: 2px; }

.auth-foot { color: #8b93b8; font-size: .8rem; }

.auth-panel { display: grid; place-items: center; padding: 2.5rem 1.5rem; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h2 { font-size: 1.45rem; margin-bottom: .35rem; }
.auth-card .lead { color: var(--muted); margin-bottom: 1.5rem; }
.auth-card .btn--block { padding: .7rem 1rem; }
.auth-card .brand { color: var(--text); padding: 0 0 1.5rem; display: none; }
.auth-help { margin-top: 1.25rem; padding: .85rem 1rem; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px dashed var(--border-strong); color: var(--muted); font-size: .85rem; }

.input-icon { position: relative; }
.input-icon .icon { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: #94a3b8; pointer-events: none; }
.input-icon input { padding-left: 2.4rem; }

/* ---------- Checkout ---------- */

.checkout-body {
    background: radial-gradient(900px 420px at 50% -120px, rgba(99, 102, 241, .22), transparent 70%), var(--bg);
    min-height: 100vh;
    padding: 2rem 1rem 3rem;
}

.checkout {
    max-width: 430px;
    margin: 0 auto;
    background: var(--surface);
    border-radius: 22px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.checkout-header {
    text-align: center;
    padding: 1.6rem 1.5rem 2.6rem;
    background: var(--brand-gradient);
    color: #fff;
}

.checkout-merchant { color: rgba(255, 255, 255, .85); font-weight: 600; font-size: .9rem; letter-spacing: .02em; }
.checkout-amount { font-size: 2.5rem; font-weight: 800; letter-spacing: -.03em; margin-top: .25rem; font-variant-numeric: tabular-nums; }
.checkout-amount .currency { font-size: 1rem; font-weight: 700; color: rgba(255, 255, 255, .8); margin-right: .25rem; }
.checkout-description { color: rgba(255, 255, 255, .8); font-size: .9rem; margin-top: .25rem; }

.checkout-stepnav { display: flex; align-items: center; gap: .6rem; padding: 1.1rem 1.5rem 0; color: var(--muted); font-size: .82rem; font-weight: 600; }
.checkout-stepnav .step { display: inline-flex; align-items: center; gap: .4rem; }
.checkout-stepnav .step-num { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--neutral-soft); color: var(--muted); font-size: .78rem; }
.checkout-stepnav .step.active { color: var(--primary); }
.checkout-stepnav .step.active .step-num { background: var(--primary); color: #fff; }
.checkout-stepnav .step.done { color: var(--success); }
.checkout-stepnav .step.done .step-num { background: var(--success); color: #fff; }
.checkout-stepnav .step-line { flex: 1; height: 2px; background: var(--border); border-radius: 2px; }
.checkout-scan-hint { margin: .85rem 0 0; color: var(--muted); font-size: .88rem; text-align: center; }

.checkout-phone { padding: 1.25rem 1.5rem 0; }
.phone-prompt strong { display: block; color: var(--text); margin-bottom: .25rem; }
.phone-prompt p { color: var(--muted); font-size: .88rem; margin-bottom: .75rem; }
.phone-form { display: flex; gap: .5rem; }
.phone-form input { flex: 1; font-family: var(--mono); letter-spacing: .03em; }
.phone-form .btn { white-space: nowrap; }
.phone-saved { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .7rem .9rem; background: var(--success-soft); border: 1px solid var(--success-border); border-radius: var(--radius-sm); color: #065f46; }
.phone-saved .icon { vertical-align: -3px; color: var(--success); }
.phone-error { color: var(--danger); font-size: .85rem; margin-top: .4rem; }

.checkout-qr { padding: 0 1.5rem; margin-top: 1rem; }

.qr-frame {
    width: 100%;
    max-width: 272px;
    aspect-ratio: 1;
    margin: 0 auto;
    padding: .7rem;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 14px 30px -18px rgba(15, 23, 42, .45);
}

.qr-frame svg { width: 100%; height: 100%; display: block; }
.qr-frame.is-hidden { display: none; }

.qr-state { text-align: center; padding: 2.4rem .5rem .5rem; background: #fff; border-radius: 18px; }
.qr-state p { color: var(--muted); }
.qr-state-icon {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    margin: 0 auto .85rem;
    display: grid;
    place-items: center;
    font-size: 1.8rem;
}
.qr-state--expired .qr-state-icon { background: var(--neutral-soft); color: var(--muted); }
.qr-state--paid .qr-state-icon { background: var(--success-soft); color: var(--success); box-shadow: 0 0 0 8px rgba(16, 185, 129, .08); }
.qr-state--failed .qr-state-icon { background: var(--danger-soft); color: var(--danger); }

.checkout-timer { padding: 1.2rem 1.5rem 0; }
.timer-row { display: flex; justify-content: space-between; color: var(--muted); font-size: .9rem; }
.timer-row strong { color: var(--text); font-variant-numeric: tabular-nums; font-size: 1rem; }
.timer-bar { height: 7px; background: var(--neutral-soft); border-radius: 99px; overflow: hidden; margin-top: .45rem; }
.timer-bar-fill { height: 100%; width: 100%; background: var(--brand-gradient); transition: width .25s linear; }
.checkout-timer.is-urgent .timer-bar-fill { background: var(--danger); }
.checkout-timer.is-urgent strong { color: var(--danger); }

.checkout-details { margin: 1.25rem 1.5rem 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.checkout-details > div { display: flex; justify-content: space-between; gap: 1rem; padding: .6rem .9rem; border-bottom: 1px solid var(--border); }
.checkout-details > div:last-child { border-bottom: 0; }
.checkout-details dt { color: var(--muted); }
.checkout-details dd { margin: 0; text-align: right; word-break: break-all; color: var(--text-2); }

.checkout-steps { margin: 1.2rem 1.5rem 1.4rem; padding-left: 1.2rem; color: var(--muted); font-size: .9rem; }
.checkout-steps li { margin-bottom: .25rem; }
.checkout-redirect { text-align: center; color: var(--muted); padding: 0 1.5rem 1.5rem; }
.checkout-foot { display: flex; justify-content: center; align-items: center; gap: .4rem; padding: .9rem 1.5rem; border-top: 1px solid var(--border); background: var(--surface-2); color: var(--muted); font-size: .78rem; }
.checkout-foot .icon { color: var(--success); }

/* Checkout branding (logo, tagline, Telegram / custom button) */
.checkout-logo { max-height: 46px; max-width: 70%; margin: 0 auto .6rem; display: block; object-fit: contain; }
.checkout-tagline { color: rgba(255, 255, 255, .9); font-size: .95rem; margin-top: .55rem; }
.checkout-actions { display: flex; gap: .6rem; padding: 0 1.5rem 1rem; }
.checkout-action { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .7rem 1rem; border-radius: var(--radius-sm); font-weight: 600; font-size: .92rem; text-decoration: none; border: 1px solid var(--border); }
.checkout-action--tg { background: #229ed9; color: #fff; border-color: #229ed9; }
.checkout-action--cta { background: var(--primary); color: #fff; border-color: var(--primary); }
.checkout-action .icon { color: currentColor; }

/* Admin: checkout branding editor */
.brand-preview { padding: .6rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); display: inline-block; margin-bottom: .5rem; }
.brand-preview img { max-height: 48px; max-width: 220px; display: block; }
.codes-table { width: 100%; min-width: 440px; border-collapse: collapse; margin: .5rem 0 1rem; }
.codes-table th { text-align: left; font-size: .8rem; color: var(--muted); padding: .4rem .5rem; font-weight: 600; }
.codes-table td { padding: .3rem .5rem; border-top: 1px solid var(--border); vertical-align: middle; }
.codes-table .codes-allow { text-align: center; width: 70px; }
.codes-table input[type="text"] { width: 100%; }
.form-actions { margin-top: 1.2rem; }

/* Staff permission grid */
.perm-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1rem 1.5rem; margin-top: .5rem; }
.perm-group-title { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: .45rem; }
.perm-group label.checkbox { display: flex; align-items: center; gap: .45rem; margin-bottom: .3rem; font-size: .9rem; }

/* ---------- Docs ---------- */

.docs-top {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: .8rem 2rem;
    background: rgba(255, 255, 255, .9);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
}

.docs-top .brand { color: var(--text); padding: 0; }

.docs-hero { background: var(--brand-gradient); color: #fff; padding: 3rem 1.25rem 3.25rem; }
.docs-hero > div { max-width: 900px; margin: 0 auto; }
.docs-hero h1 { color: #fff; font-size: 2rem; margin-bottom: .5rem; }
.docs-hero p { color: rgba(255, 255, 255, .85); font-size: 1.02rem; margin: 0; }

.docs { max-width: 900px; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; counter-reset: docs-section; }
.docs h2 { margin-top: 2.25rem; padding-top: 1rem; border-top: 1px solid var(--border); font-size: 1.2rem; counter-increment: docs-section; }
.docs h2::before { content: counter(docs-section) ". "; color: var(--primary-strong); }
.docs pre {
    background: #0f172a;
    color: #dbe5ee;
    padding: 1rem 1.1rem;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    font-size: .82rem;
    line-height: 1.6;
    box-shadow: var(--shadow);
}
.docs table { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); margin: .5rem 0 1rem; overflow: hidden; }
.docs code { background: var(--primary-soft); color: var(--primary-strong); padding: .08rem .35rem; border-radius: 5px; }
.docs pre code { background: none; color: inherit; padding: 0; }

/* ---------- Responsive ---------- */

@media (max-width: 1100px) {
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
    .auth-split { grid-template-columns: 1fr; }
    .auth-brand { display: none; }
    .auth-card .brand { display: flex; }
}

@media (max-width: 820px) {
    .admin { display: block; }
    .sidebar { position: static; height: auto; padding: .85rem 1rem; }
    .brand { padding-bottom: 0; }
    .nav-burger { display: inline-flex; }
    .sidebar-toggle { display: none; }
    .nav { display: none; flex-wrap: wrap; gap: .25rem; width: 100%; margin-top: .6rem; overflow: visible; }
    .nav-toggle:checked ~ .sidebar .nav { display: flex; }
    .nav a.active::before { display: none; }
    .nav-section { width: 100%; padding-top: .5rem; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .content, .topbar, .docs-top { padding-left: 1rem; padding-right: 1rem; }
    .content { padding-top: 1.25rem; padding-bottom: 2.5rem; }
    .kv { grid-template-columns: 1fr; }
    .page-head { flex-direction: column; align-items: flex-start; gap: .6rem; }
    .topbar { flex-wrap: wrap; gap: .5rem; }
}
