/* KashLipa design system
   Tokens first, then base, components, and page-level layouts.
   Mobile-first: min-width media queries only. */

@font-face {
    font-family: "Inter";
    src: url("../fonts/InterVariable.woff2") format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

:root {
    --red-50: #FFF5F5;
    --red-100: #FEE2E2;
    --red-600: #E11D2E;
    --red-700: #B91C1C;

    --ink: #0F172A;
    --ink-2: #334155;
    --muted: #64748B;
    --subtle: #94A3B8;
    --border: #E2E8F0;
    --border-strong: #CBD5E1;
    --bg: #F8FAFC;
    --surface: #FFFFFF;

    --green-50: #F0FDF4;
    --green-100: #DCFCE7;
    --green-700: #15803D;
    --amber-50: #FFFBEB;
    --amber-100: #FEF3C7;
    --amber-700: #B45309;
    --blue-50: #EFF6FF;
    --blue-700: #1D4ED8;

    --primary: var(--red-600);
    --primary-hover: var(--red-700);
    --primary-tint: var(--red-100);

    --radius-sm: 8px;
    --radius: 10px;
    --radius-lg: 12px;
    --radius-pill: 999px;

    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
    --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 6px 20px -8px rgba(15, 23, 42, .10);
    --shadow-lg: 0 2px 4px rgba(15, 23, 42, .04), 0 18px 40px -12px rgba(15, 23, 42, .18);
    --ring: 0 0 0 3px rgba(225, 29, 46, .18);

    --font: "Inter", "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", Menlo, Consolas, monospace;

    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
}

/* ---------- Base ---------- */

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

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.55;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: "cv11", "ss01";
}

img, svg { display: block; max-width: 100%; }

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

h1, h2, h3, h4, p { margin: 0; }

code, pre, kbd { font-family: var(--font-mono); font-size: .875em; }
code { background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; }

:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-sm); }

::selection { background: var(--primary-tint); }

.h1 { font-size: 28px; line-height: 1.2; font-weight: 700; letter-spacing: -.02em; }
.h2 { font-size: 21px; line-height: 1.3; font-weight: 650; letter-spacing: -.01em; }
.h3 { font-size: 16px; line-height: 1.4; font-weight: 600; }
.lead { font-size: 17px; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: var(--space-2); }
.muted { color: var(--muted); }
.text-sm { font-size: 13px; }
.optional { font-weight: 400; color: var(--subtle); font-size: 12px; margin-left: 4px; }

/* Amounts always line up in tables and cards. */
.amount, .num, td.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; white-space: nowrap; }

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.stack > * + * { margin-top: var(--space-5); }
.stack-sm > * + * { margin-top: var(--space-3); }

.grid { display: grid; gap: var(--space-4); }
.grid-2, .grid-3-1 { grid-template-columns: 1fr; }

@media (min-width: 640px) {
    .grid-2 { grid-template-columns: 1fr 1fr; }
    .grid-3-1 { grid-template-columns: 3fr 1fr; }
    .h1 { font-size: 34px; }
}

/* ---------- Icons ---------- */

.icon {
    width: 18px; height: 18px; flex: none;
    stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

/* ---------- Brand ---------- */

.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); }
.brand:hover { color: var(--ink); text-decoration: none; }
.brand-name { font-weight: 700; font-size: 19px; letter-spacing: -.02em; }

/* ---------- Buttons ---------- */

.btn {
    --btn-bg: var(--surface);
    --btn-fg: var(--ink);
    --btn-border: var(--border);
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 42px; padding: 0 18px;
    font: inherit; font-weight: 600; font-size: 14px; line-height: 1;
    color: var(--btn-fg); background: var(--btn-bg);
    border: 1px solid var(--btn-border); border-radius: var(--radius);
    cursor: pointer; white-space: nowrap; user-select: none;
    transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s;
    -webkit-tap-highlight-color: transparent;
}
.btn:hover { text-decoration: none; color: var(--btn-fg); }
.btn .icon { width: 16px; height: 16px; }

.btn-primary { --btn-bg: var(--primary); --btn-fg: #fff; --btn-border: var(--primary); box-shadow: 0 1px 2px rgba(185, 28, 28, .25); }
.btn-primary:hover { --btn-bg: var(--primary-hover); --btn-border: var(--primary-hover); }

.btn-secondary { --btn-bg: var(--surface); box-shadow: var(--shadow-sm); }
.btn-secondary:hover { --btn-bg: var(--bg); --btn-border: var(--border-strong); }

.btn-ghost { --btn-bg: transparent; --btn-border: transparent; --btn-fg: var(--ink-2); }
.btn-ghost:hover { --btn-bg: var(--bg); }

.btn-danger { --btn-bg: var(--surface); --btn-fg: var(--red-700); --btn-border: var(--red-100); }
.btn-danger:hover { --btn-bg: var(--red-50); }

.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: var(--radius-sm); }
.btn-lg { min-height: 50px; padding: 0 24px; font-size: 15px; }
.btn-block { display: flex; width: 100%; }

.btn[disabled], .btn.is-disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }

.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading > * { visibility: hidden; }
.btn.is-loading::after {
    content: ""; position: absolute; width: 18px; height: 18px;
    border: 2px solid currentColor; border-color: var(--btn-fg) transparent var(--btn-fg) transparent;
    border-radius: 50%; animation: spin .7s linear infinite;
}
.btn.is-loading[data-loading-label]::before {
    content: attr(data-loading-label); position: absolute; left: 0; right: 0; padding-left: 26px;
    color: var(--btn-fg); font-weight: 600; text-align: center;
}
.btn.is-loading[data-loading-label]::after { left: 16px; }

@keyframes spin { to { transform: rotate(360deg); } }

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

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.hint { font-size: 13px; color: var(--muted); }
.field-error { font-size: 13px; color: var(--red-700); font-weight: 500; }

.input, .select, .textarea {
    width: 100%; min-height: 44px; padding: 10px 12px;
    font: inherit; font-size: 15px; color: var(--ink);
    background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius);
    transition: border-color .15s, box-shadow .15s;
    -webkit-appearance: none; appearance: none;
}
.input::placeholder, .textarea::placeholder { color: var(--subtle); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--subtle); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
.input.has-error, .select.has-error, .textarea.has-error { border-color: var(--red-600); }
.input[readonly] { background: var(--bg); }
.textarea { min-height: 96px; resize: vertical; }

.select {
    padding-right: 36px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center;
}

/* Amount and phone inputs read better with a fixed prefix ("TSh", "+255"). */
.input-affix { position: relative; display: flex; align-items: stretch; }
.input-affix .input { flex: 1; }
.input-affix-btn {
    position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border: 0; background: transparent; color: var(--muted);
    border-radius: var(--radius-sm); cursor: pointer;
}
.input-affix-btn:hover { color: var(--ink); background: var(--bg); }
.input-affix:has(.input-affix-btn) .input { padding-right: 44px; }

.input-prefix {
    display: inline-flex; align-items: center; padding: 0 12px;
    font-weight: 600; color: var(--muted); background: var(--bg);
    border: 1px solid var(--border-strong); border-right: 0; border-radius: var(--radius) 0 0 var(--radius);
}
.input-prefix + .input { border-radius: 0 var(--radius) var(--radius) 0; }

.checkbox { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.checkbox input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--primary); flex: none; }

/* ---------- Cards ---------- */

.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); box-shadow: var(--shadow);
}
.card-header { padding: var(--space-6) var(--space-5) 0; }
.card-header > * + * { margin-top: 6px; }
.card-body { padding: var(--space-5); }
.card-footer {
    display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
    padding: var(--space-4) var(--space-5); border-top: 1px solid var(--border);
    background: var(--bg); border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.card-footer form { margin: 0; }

@media (min-width: 640px) {
    .card-header { padding: var(--space-8) var(--space-8) 0; }
    .card-body { padding: var(--space-6) var(--space-8) var(--space-8); }
    .card-footer { padding: var(--space-4) var(--space-8); }
}

/* ---------- Alerts ---------- */

.alert {
    display: flex; gap: 12px; align-items: flex-start;
    padding: 12px 14px; border-radius: var(--radius);
    border: 1px solid var(--border); background: var(--bg); font-size: 14px; color: var(--ink-2);
}
.alert .icon { margin-top: 2px; }
.alert-error { background: var(--red-50); border-color: var(--red-100); color: var(--red-700); }
.alert-success { background: var(--green-50); border-color: var(--green-100); color: var(--green-700); }
.alert-warning { background: var(--amber-50); border-color: var(--amber-100); color: var(--amber-700); }
.alert-info { background: var(--blue-50); border-color: #DBEAFE; color: var(--ink-2); }
.alert-info .icon { color: var(--blue-700); }

/* ---------- Badges ---------- */

.badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 2px 10px; border-radius: var(--radius-pill);
    font-size: 12px; font-weight: 600; line-height: 20px; white-space: nowrap;
    background: var(--bg); color: var(--ink-2); border: 1px solid var(--border);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-success { background: var(--green-50); color: var(--green-700); border-color: var(--green-100); }
.badge-pending { background: var(--amber-50); color: var(--amber-700); border-color: var(--amber-100); }
.badge-failed { background: var(--red-50); color: var(--red-700); border-color: var(--red-100); }
.badge-neutral { color: var(--muted); }

/* ---------- Stepper ---------- */

.stepper {
    display: flex; gap: 4px; list-style: none; margin: 0 0 var(--space-5); padding: 0;
    counter-reset: step; overflow-x: auto; scrollbar-width: none;
}
.stepper::-webkit-scrollbar { display: none; }
.stepper-item {
    flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 6px;
    position: relative; font-size: 12px; color: var(--muted); text-align: center;
}
.stepper-item:not(:last-child)::after {
    content: ""; position: absolute; top: 14px; left: calc(50% + 18px); right: calc(-50% + 18px);
    height: 2px; background: var(--border); border-radius: 2px;
}
.stepper-item.is-done:not(:last-child)::after { background: var(--primary); }
.stepper-dot {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border-radius: 50%;
    font-weight: 700; font-size: 13px; background: var(--surface);
    border: 2px solid var(--border-strong); color: var(--muted);
}
.stepper-dot .icon { width: 14px; height: 14px; stroke-width: 3; }
.stepper-item.is-current { color: var(--ink); font-weight: 600; }
.stepper-item.is-current .stepper-dot { border-color: var(--primary); color: var(--primary); box-shadow: var(--ring); }
.stepper-item.is-done .stepper-dot { background: var(--primary); border-color: var(--primary); color: #fff; }
.stepper-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

@media (max-width: 479px) {
    .stepper-item:not(.is-current) .stepper-label { display: none; }
}

/* ---------- Checklist (installer, KYC progress) ---------- */

.checklist { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.checklist-item {
    display: grid; grid-template-columns: 24px 1fr; gap: 2px 10px; align-items: start;
    padding: 10px 14px; font-size: 14px;
}
.checklist-item + .checklist-item { border-top: 1px solid var(--border); }
.checklist-icon { grid-row: span 2; padding-top: 1px; }
.checklist-label { font-weight: 600; }
.checklist-detail { color: var(--muted); font-size: 13px; }
.checklist-item.is-ok .checklist-icon { color: var(--green-700); }
.checklist-item.is-fail { background: var(--red-50); }
.checklist-item.is-fail .checklist-icon, .checklist-item.is-fail .checklist-detail { color: var(--red-700); }
.checklist-item.is-warn .checklist-icon { color: var(--amber-700); }

@media (min-width: 640px) {
    .checklist-item { grid-template-columns: 24px minmax(160px, 1fr) 2fr; }
    .checklist-icon { grid-row: auto; }
}

/* ---------- Summary list ---------- */

.summary { margin: 0; border: 1px solid var(--border); border-radius: var(--radius); }
.summary-row { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; }
.summary-row + .summary-row { border-top: 1px solid var(--border); }
.summary dt { font-size: 13px; color: var(--muted); }
.summary dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }

@media (min-width: 640px) {
    .summary-row { flex-direction: row; gap: 16px; }
    .summary dt { flex: 0 0 140px; font-size: 14px; }
}

/* ---------- Code block ---------- */

.code-block {
    display: flex; align-items: center; gap: 10px; margin: 10px 0 6px;
    padding: 10px 10px 10px 14px; background: var(--ink); color: #E2E8F0;
    border-radius: var(--radius); overflow: hidden;
}
.code-block code {
    flex: 1; min-width: 0; padding: 0; background: none; border: 0; color: inherit;
    font-size: 13px; overflow-x: auto; white-space: nowrap;
}
.code-block .btn { flex: none; }

/* ---------- Toasts ---------- */

.toast-region {
    position: fixed; z-index: 100; left: 16px; right: 16px; bottom: 16px;
    display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.toast {
    display: flex; gap: 10px; align-items: flex-start; pointer-events: auto;
    padding: 12px 14px; background: var(--ink); color: #fff; border-radius: var(--radius);
    box-shadow: var(--shadow-lg); font-size: 14px; font-weight: 500;
    animation: toast-in .2s ease-out;
}
.toast .icon { margin-top: 1px; }
.toast-success .icon { color: #4ADE80; }
.toast-error .icon { color: #F87171; }
.toast-warning .icon { color: #FBBF24; }
.toast.is-leaving { opacity: 0; transform: translateY(6px); transition: opacity .2s, transform .2s; }

@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (min-width: 640px) {
    .toast-region { left: auto; right: 24px; bottom: 24px; width: 380px; }
}

/* ---------- Modal (confirm dialogs for money actions) ---------- */

.modal {
    width: min(440px, calc(100vw - 32px)); padding: 0; border: 0;
    border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); color: var(--ink);
}
.modal::backdrop { background: rgba(15, 23, 42, .45); backdrop-filter: blur(2px); }
.modal-body { padding: var(--space-6); }
.modal-body > * + * { margin-top: 8px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: var(--space-4) var(--space-6); background: var(--bg); border-top: 1px solid var(--border); }

/* ---------- Skeleton loaders ---------- */

.skeleton {
    display: block; height: 14px; border-radius: 6px;
    background: linear-gradient(90deg, #EEF2F6 0%, #F8FAFC 50%, #EEF2F6 100%);
    background-size: 200% 100%; animation: shimmer 1.2s ease-in-out infinite;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- Installer ---------- */

.installer-shell { width: 100%; max-width: 760px; margin: 0 auto; padding: var(--space-5) var(--space-4) var(--space-10); }
.installer-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-6); }
.installer-version { font-size: 13px; color: var(--muted); }
.installer-foot { margin-top: var(--space-5); text-align: center; font-size: 13px; color: var(--muted); }
.installer-done { text-align: center; }
.success-mark {
    display: inline-flex; width: 56px; height: 56px; align-items: center; justify-content: center;
    border-radius: 50%; background: var(--green-50); color: var(--green-700); margin-bottom: var(--space-2);
}
.success-mark .icon { width: 30px; height: 30px; }
.install-log { list-style: none; margin: 0; padding: 12px 14px; background: var(--bg); border-radius: var(--radius); font-size: 14px; }
.install-log li { display: flex; gap: 8px; align-items: center; padding: 3px 0; }
.install-log .icon { color: var(--green-700); width: 16px; height: 16px; }
.next-steps { margin: 0; padding-left: 20px; }
.next-steps li { padding-left: 4px; }
.next-steps li + li { margin-top: var(--space-4); }

@media (min-width: 640px) {
    .installer-shell { padding-top: var(--space-10); }
}

/* ---------- Minimal pages (errors, holding page) ---------- */

.minimal { min-height: 100vh; display: flex; flex-direction: column; background: var(--surface); }
.minimal-header { padding: var(--space-5) var(--space-4); max-width: 1120px; width: 100%; margin: 0 auto; }
.minimal-main { flex: 1; display: flex; align-items: center; justify-content: center; padding: var(--space-6) var(--space-4) var(--space-10); }

.error-page { max-width: 520px; text-align: center; }
.error-page > * + * { margin-top: var(--space-3); }
.error-icon {
    display: inline-flex; width: 56px; height: 56px; align-items: center; justify-content: center;
    border-radius: 16px; background: var(--red-50); color: var(--primary);
}
.error-icon .icon { width: 26px; height: 26px; }
.error-actions { margin-top: var(--space-6) !important; }
.debug-trace { margin-top: var(--space-8) !important; text-align: left; font-size: 13px; }
.debug-trace summary { cursor: pointer; font-weight: 600; color: var(--red-700); }
.debug-trace pre { overflow-x: auto; padding: 12px; background: var(--bg); border-radius: var(--radius); font-size: 12px; }

.holding { max-width: 640px; text-align: center; }
.holding > * + * { margin-top: var(--space-4); }
.channel-strip { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; list-style: none; padding: 0; margin-top: var(--space-6) !important; }
.channel-strip li { padding: 6px 12px; border: 1px solid var(--border); border-radius: var(--radius-pill); font-size: 13px; font-weight: 600; color: var(--ink-2); background: var(--bg); }
.lang-switch { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; margin-top: var(--space-8) !important; }
.lang-switch .icon { width: 16px; height: 16px; }

/* ---------- Utilities added with the admin panel ---------- */

.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mono { font-family: var(--font-mono); font-size: 12.5px; overflow-wrap: anywhere; }
.nowrap { white-space: nowrap; }
.icon-inline { display: inline-block; width: 15px; height: 15px; vertical-align: -2px; }
.icon-inline.is-ok { color: var(--green-700); }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.button-row form { margin: 0; }
.label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.alert a { color: inherit; font-weight: 600; text-decoration: underline; }
.mono-list { margin: 6px 0 0; padding-left: 18px; font-family: var(--font-mono); font-size: 12.5px; }

/* ---------- Auth pages (admin and merchant sign-in) ---------- */

.auth { min-height: 100vh; background: var(--bg); }
.auth-shell { width: 100%; max-width: 420px; margin: 0 auto; padding: var(--space-8) var(--space-4) var(--space-10); }
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: var(--space-6); }
.auth-card .card-body { padding: var(--space-6); }
.auth-below { margin-top: var(--space-5); text-align: center; }
.auth-below .icon { display: inline-block; width: 14px; height: 14px; vertical-align: -2px; }
.auth .success-mark { margin: 0; }

.brand-badge {
    display: inline-flex; align-items: center; padding: 2px 8px; border-radius: var(--radius-pill);
    font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
    color: var(--primary); background: var(--red-50); border: 1px solid var(--red-100);
}

@media (min-width: 640px) {
    .auth-shell { padding-top: 12vh; }
    .auth-card .card-body { padding: var(--space-8); }
}

/* ---------- App shell: sidebar + topbar ---------- */

.app-shell { min-height: 100vh; }

.sidebar {
    position: fixed; z-index: 60; inset: 0 auto 0 0; width: 264px;
    display: flex; flex-direction: column;
    background: var(--surface); border-right: 1px solid var(--border);
    transform: translateX(-100%); transition: transform .2s ease;
}
.sidebar.is-open { transform: none; box-shadow: var(--shadow-lg); }
.sidebar-backdrop { display: none; position: fixed; z-index: 55; inset: 0; background: rgba(15, 23, 42, .4); }
.sidebar.is-open + .sidebar-backdrop { display: block; }

.sidebar-head { display: flex; align-items: center; gap: 10px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.sidebar-head .brand-name { font-size: 17px; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 2px; }
.nav-link {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm);
    font-size: 14px; font-weight: 500; color: var(--ink-2);
}
.nav-link .icon { color: var(--subtle); }
.nav-link:hover { background: var(--bg); color: var(--ink); text-decoration: none; }
.nav-link.is-active { background: var(--red-50); color: var(--primary-hover); font-weight: 600; }
.nav-link.is-active .icon { color: var(--primary); }
.nav-group-label { padding: 16px 12px 6px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--subtle); }
.sidebar-foot {
    display: flex; justify-content: space-between; align-items: center; gap: 8px;
    padding: 14px 20px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted);
}
.sidebar-foot a { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.sidebar-foot .icon { width: 13px; height: 13px; }

.app-main { min-width: 0; }

.topbar {
    position: sticky; top: 0; z-index: 40;
    display: flex; align-items: center; gap: 12px; height: 60px; padding: 0 var(--space-4);
    background: rgba(255, 255, 255, .92); backdrop-filter: saturate(1.4) blur(8px);
    border-bottom: 1px solid var(--border);
}
.topbar-menu {
    display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px;
    border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); cursor: pointer;
}
.topbar-title { flex: 1; min-width: 0; font-size: 17px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.env-badge { padding: 3px 10px; border-radius: var(--radius-pill); font-size: 12px; font-weight: 700; white-space: nowrap; }
.env-sandbox { background: var(--amber-50); color: var(--amber-700); border: 1px solid var(--amber-100); }
.env-live { background: var(--green-50); color: var(--green-700); border: 1px solid var(--green-100); }

.user-menu { position: relative; }
.user-menu summary {
    display: flex; align-items: center; gap: 8px; list-style: none; cursor: pointer;
    padding: 4px; border-radius: var(--radius-pill);
}
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary .icon { width: 15px; height: 15px; color: var(--muted); }
.user-menu-name { display: none; font-size: 14px; font-weight: 600; }
.avatar {
    display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px;
    border-radius: 50%; background: var(--ink); color: #fff; font-size: 13px; font-weight: 700;
}
.menu {
    position: absolute; right: 0; top: calc(100% + 8px); z-index: 50; width: 240px; padding: 6px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.menu form { margin: 0; }
.menu-head { display: flex; flex-direction: column; padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.menu-item {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: var(--radius-sm);
    background: none; font: inherit; font-size: 14px; color: var(--ink-2); text-align: left; cursor: pointer;
}
.menu-item:hover { background: var(--bg); color: var(--ink); text-decoration: none; }
.menu-item .icon { width: 16px; height: 16px; color: var(--muted); }

.banner { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px var(--space-4); font-size: 14px; }
.banner a { font-weight: 600; color: inherit; text-decoration: underline; }
.banner-warning { background: var(--amber-50); color: var(--amber-700); border-bottom: 1px solid var(--amber-100); }

.page { padding: var(--space-5) var(--space-4) var(--space-10); max-width: 1240px; }
.page > .alert { margin-bottom: var(--space-5); }

@media (min-width: 1024px) {
    .sidebar { transform: none; }
    .sidebar-backdrop, .sidebar.is-open + .sidebar-backdrop { display: none; }
    .app-main { margin-left: 264px; }
    .topbar { padding: 0 var(--space-8); }
    .topbar-menu { display: none; }
    .user-menu-name { display: inline; }
    .page { padding: var(--space-8); }
}

/* ---------- Dashboard pieces ---------- */

.stat-grid { display: grid; gap: var(--space-4); grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stat-card {
    display: flex; flex-direction: column; gap: 4px; padding: var(--space-4) var(--space-5);
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
}
.stat-card.is-attention { border-color: var(--amber-100); background: linear-gradient(0deg, var(--surface), var(--amber-50)); }
.stat-label { font-size: 13px; color: var(--muted); font-weight: 500; }
.stat-value { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.stat-meta { font-size: 12px; color: var(--subtle); }

@media (min-width: 768px) { .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .stat-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

.card-section-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--border);
}
.card-section-head form { margin: 0; }

.status-list { list-style: none; margin: 0; padding: 0; }
.status-list li { display: flex; align-items: flex-start; gap: 12px; padding: 14px var(--space-5); }
.status-list li + li { border-top: 1px solid var(--border); }
.status-list li > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.status-dot { flex: none; width: 10px; height: 10px; margin-top: 6px; border-radius: 50%; background: var(--subtle); }
.status-dot.is-ok { background: #22C55E; box-shadow: 0 0 0 3px var(--green-50); }
.status-dot.is-warn { background: #F59E0B; box-shadow: 0 0 0 3px var(--amber-50); }
.status-dot.is-fail { background: var(--primary); box-shadow: 0 0 0 3px var(--red-50); }

.activity-list { list-style: none; margin: 0; padding: 0; }
.activity-list li { display: flex; flex-direction: column; gap: 2px; padding: 12px var(--space-5); font-size: 14px; }
.activity-list li + li { border-top: 1px solid var(--border); }

.empty-state { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: var(--space-10) var(--space-5); text-align: center; }
.empty-state > .icon { width: 32px; height: 32px; color: var(--subtle); margin-bottom: 8px; }
.empty-state.compact { padding: var(--space-6) var(--space-5); }

/* ---------- Tabs ---------- */

.tabs { display: flex; gap: 4px; margin-bottom: var(--space-5); border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
    padding: 10px 14px; margin-bottom: -1px; white-space: nowrap;
    font-size: 14px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent;
}
.tab:hover { color: var(--ink); text-decoration: none; }
.tab.is-active { color: var(--primary); border-bottom-color: var(--primary); }

.settings-layout { display: grid; gap: var(--space-5); align-items: start; }
@media (min-width: 1024px) { .settings-layout { grid-template-columns: minmax(0, 1fr) 340px; } }

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

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
    padding: 10px var(--space-5); text-align: left; white-space: nowrap;
    font-size: 12px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--muted);
    background: var(--bg); border-bottom: 1px solid var(--border);
}
.table td { padding: 12px var(--space-5); border-bottom: 1px solid var(--border); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #FCFDFE; }
.table th.num, .table td.num { text-align: right; }
.table td.actions { white-space: nowrap; text-align: right; }
.table td.actions > *, .table td.actions form { display: inline-block; margin: 0; vertical-align: middle; }

.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: var(--space-4); }
.filter-bar .filter-search { flex: 1 1 260px; }
.filter-bar .select { width: auto; flex: 0 0 auto; }

.pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; width: 100%; font-size: 13px; color: var(--muted); }
.pagination-links { display: flex; align-items: center; gap: 8px; }

.log-details { margin-top: 6px; }
.log-details summary { cursor: pointer; color: var(--muted); }
.log-details pre { max-height: 260px; overflow: auto; padding: 10px; background: var(--bg); border-radius: var(--radius-sm); font-size: 12px; white-space: pre-wrap; }

.inline-menu { position: relative; }
.inline-menu summary { list-style: none; }
.inline-menu summary::-webkit-details-marker { display: none; }
.inline-menu-panel {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; width: 300px; padding: var(--space-4);
    text-align: left; white-space: normal; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
}

/* ---------- Update job progress ---------- */

.job-card { margin-bottom: var(--space-6); border-color: var(--border-strong); }
.job-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.progress { height: 8px; border-radius: var(--radius-pill); background: var(--bg); border: 1px solid var(--border); overflow: hidden; }
.progress-bar { display: block; height: 100%; background: var(--primary); border-radius: inherit; transition: width .4s ease; }
.log-list {
    list-style: none; margin: 0; padding: 10px 12px; max-height: 280px; overflow-y: auto;
    background: var(--ink); color: #E2E8F0; border-radius: var(--radius); font-family: var(--font-mono); font-size: 12.5px; line-height: 1.7;
}
.log-list time { color: #94A3B8; margin-right: 6px; }
.changelog { margin: 0; padding-left: 18px; font-size: 14px; }
.changelog li + li { margin-top: 4px; }

/* ---------- Shared additions (1.2.0) ---------- */

.narrow { max-width: 760px; }
.mb-4 { margin-bottom: var(--space-4); }
.hidden, [hidden] { display: none !important; }
.nav-count {
    margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: var(--radius-pill);
    font-size: 12px; font-weight: 700; text-align: center; color: #fff; background: var(--primary);
}
.nav-dot { margin-left: auto; width: 8px; height: 8px; border-radius: 50%; background: #F59E0B; }
.tab-count { margin-left: 6px; padding: 0 7px; border-radius: var(--radius-pill); font-size: 12px; background: var(--red-50); color: var(--primary); }
.banner-danger { background: var(--red-50); color: var(--red-700); border-bottom: 1px solid var(--red-100); }
.input-code { font-family: var(--font-mono); font-size: 20px; letter-spacing: .3em; text-align: center; }
.mono-input { font-family: var(--font-mono); letter-spacing: .02em; }
.inline-details summary { list-style: none; display: inline-flex; }
.inline-details summary::-webkit-details-marker { display: none; }
.hint-ok, .hint-warn { display: block; margin-top: 4px; font-size: 12.5px; }
.hint-ok { color: var(--green-700); }
.hint-warn { color: var(--amber-700); }
.summary.flush { border: 0; border-radius: 0; }

/* ---------- Auth: two-column on desktop ---------- */

.auth-shell.is-split { max-width: 1080px; }
.auth-aside { display: none; }
.lang-switch .icon { width: 15px; height: 15px; display: inline-block; vertical-align: -3px; }
.auth-below { display: flex; flex-direction: column; align-items: center; gap: 12px; }

@media (min-width: 960px) {
    .auth-shell.is-split { display: grid; grid-template-columns: 1fr 440px; gap: 64px; align-items: center; padding-top: 8vh; }
    .auth-shell.is-split .auth-brand { justify-content: flex-start; }
    .auth-aside { display: block; }
}
.auth-aside-inner {
    padding: 40px; border-radius: 20px; color: #fff;
    background: radial-gradient(120% 120% at 0% 0%, #F43F5E 0%, var(--red-600) 45%, #991B1B 100%);
    box-shadow: var(--shadow-lg);
}
.auth-aside-title { font-size: 30px; line-height: 1.2; font-weight: 700; letter-spacing: -.02em; }
.auth-aside-points { list-style: none; padding: 0; margin: 28px 0; display: flex; flex-direction: column; gap: 14px; }
.auth-aside-points li { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; }
.auth-aside-points .icon { flex: none; margin-top: 2px; color: #FECACA; }
.network-chips { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.network-chips li { padding: 6px 12px; border-radius: var(--radius-pill); font-size: 13px; font-weight: 600; background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .25); }

/* ---------- Verification page ---------- */

.verify-step { display: flex; gap: 14px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); }
.verify-step > div { flex: 1; min-width: 0; }
.verify-icon {
    flex: none; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px;
    border-radius: 12px; background: var(--red-50); color: var(--primary);
}
.verify-step.is-done { background: var(--green-50); border-color: var(--green-100); }
.verify-step.is-done .verify-icon { background: #fff; color: var(--green-700); }
.otp-row { display: flex; gap: 8px; }
.otp-row .input { max-width: 180px; }

/* ---------- Merchant shell: bottom nav on phones ---------- */

.topbar-brand { display: inline-flex; }
.balance-pill {
    display: none; align-items: baseline; gap: 8px; padding: 6px 12px;
    border: 1px solid var(--border); border-radius: var(--radius-pill); background: var(--bg); font-weight: 700; font-size: 14px;
}
.balance-pill-label { font-size: 12px; font-weight: 500; color: var(--muted); }
.sidebar-merchant { display: flex; flex-direction: column; gap: 2px; padding: 14px 20px; border-bottom: 1px solid var(--border); font-size: 14px; }

.merchant .page { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }

.bottom-nav {
    position: fixed; z-index: 50; left: 0; right: 0; bottom: 0;
    display: flex; justify-content: space-around;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, .97); border-top: 1px solid var(--border); backdrop-filter: blur(8px);
}
.bottom-nav-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px;
    font-size: 11.5px; font-weight: 600; color: var(--muted); border-radius: var(--radius-sm);
}
.bottom-nav-item:hover { text-decoration: none; color: var(--ink); }
.bottom-nav-item.is-active { color: var(--primary); }
.bottom-nav-icon { position: relative; display: inline-flex; }
.bottom-nav-icon .icon { width: 22px; height: 22px; }
.bottom-nav-icon .nav-dot { position: absolute; top: -2px; right: -4px; margin: 0; }

@media (min-width: 640px) { .balance-pill { display: inline-flex; } }

@media (min-width: 1024px) {
    .merchant .topbar-brand { display: none; }
    .merchant .page { padding-bottom: var(--space-10); }
    .bottom-nav { display: none; }
}

/* ---------- Merchant dashboard ---------- */

.page-greeting { font-size: 15px; color: var(--muted); margin-bottom: var(--space-4); }
.balance-grid { display: grid; gap: var(--space-4); grid-template-columns: 1fr; }
.balance-card {
    display: flex; flex-direction: column; gap: 4px; padding: var(--space-5);
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
}
.balance-card.is-primary {
    color: #fff; border: 0;
    background: linear-gradient(135deg, var(--ink) 0%, #1E293B 100%);
}
.balance-card.is-primary .stat-label, .balance-card.is-primary .stat-meta { color: #CBD5E1; }
.balance-value { font-size: 30px; font-weight: 700; letter-spacing: -.02em; }
.stat-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat-grid-3 .stat-card { padding: var(--space-3) var(--space-4); }
.stat-grid-3 .stat-value { font-size: 16px; }
.dashboard-grid { display: grid; gap: var(--space-5); align-items: start; }

@media (min-width: 640px) {
    .balance-grid { grid-template-columns: 3fr 2fr; }
    .stat-grid-3 .stat-value { font-size: 20px; }
}
@media (min-width: 1024px) {
    .dashboard-grid { grid-template-columns: minmax(0, 1fr) 340px; }
    .dashboard-grid > .card:only-child { grid-column: 1 / -1; }
}

.tx-list { list-style: none; margin: 0; padding: 0; }
.tx-list li { display: flex; justify-content: space-between; gap: 12px; padding: 12px var(--space-5); }
.tx-list li + li { border-top: 1px solid var(--border); }
.tx-main, .tx-side { display: flex; flex-direction: column; gap: 2px; }
.tx-side { align-items: flex-end; font-weight: 600; }

.setup-list { list-style: none; margin: 0; padding: 8px 0; }
.setup-list li { display: flex; align-items: center; gap: 12px; padding: 10px var(--space-5); font-size: 14px; }
.setup-label { flex: 1; }
.setup-check {
    flex: none; display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px;
    border-radius: 50%; border: 2px solid var(--border-strong);
}
.setup-check .icon { width: 13px; height: 13px; stroke-width: 3; }
.setup-list li.is-done .setup-check { background: var(--green-700); border-color: var(--green-700); color: #fff; }
.setup-list li.is-done .setup-label { color: var(--muted); text-decoration: line-through; }

/* ---------- KYC wizard ---------- */

.kyc-form .wizard-stepper { margin: 0; padding: var(--space-5) var(--space-5) 0; }
.kyc-form fieldset { border: 0; margin: 0; min-width: 0; }
.kyc-form legend { padding: 0; margin-bottom: 4px; }
.kyc-form:not(.is-wizard) [data-wizard-prev],
.kyc-form:not(.is-wizard) [data-wizard-next],
.kyc-form:not(.is-wizard) .wizard-stepper { display: none; }
.kyc-form.is-wizard .wizard-step:not(.is-current) { display: none; }
.kyc-form:not(.is-wizard) .wizard-step + .wizard-step { border-top: 1px solid var(--border); }
.wizard-nav { justify-content: flex-end; }
.wizard-nav [data-wizard-prev] { margin-right: auto; }

.choice-row { display: grid; gap: 8px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .choice-row { grid-template-columns: repeat(3, 1fr); } }
.choice { position: relative; cursor: pointer; }
.choice input { position: absolute; opacity: 0; }
.choice span {
    display: flex; align-items: center; gap: 8px; padding: 12px 14px; border: 1px solid var(--border-strong);
    border-radius: var(--radius); font-size: 14px; font-weight: 600;
}
.choice input:checked + span { border-color: var(--primary); background: var(--red-50); color: var(--primary-hover); box-shadow: var(--ring); }
.choice input:focus-visible + span { box-shadow: var(--ring); }

.dropzone {
    position: relative; display: flex; align-items: center; justify-content: center; min-height: 128px; padding: 16px;
    border: 1.5px dashed var(--border-strong); border-radius: var(--radius); background: var(--bg);
    cursor: pointer; text-align: center; transition: border-color .15s, background-color .15s; overflow: hidden;
}
.dropzone:hover, .dropzone.is-dragover { border-color: var(--primary); background: var(--red-50); }
.dropzone.has-error { border-color: var(--red-600); }
.dropzone.has-file { border-style: solid; border-color: var(--green-700); background: var(--green-50); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone-body { display: flex; flex-direction: column; align-items: center; gap: 4px; pointer-events: none; }
.dropzone-body .icon { width: 24px; height: 24px; color: var(--muted); }
.dropzone-text { font-size: 14px; font-weight: 600; }
.dropzone-hint { font-size: 12px; color: var(--muted); }
.dropzone-preview { display: flex; align-items: center; gap: 10px; pointer-events: none; font-size: 13px; font-weight: 600; text-align: left; word-break: break-all; }
.dropzone-preview img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; flex: none; }

.status-hero { display: flex; gap: 16px; align-items: flex-start; }
.status-hero-icon { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 52px; height: 52px; border-radius: 16px; }
.status-hero-icon .icon { width: 26px; height: 26px; }
.status-hero.is-ok .status-hero-icon { background: var(--green-50); color: var(--green-700); }
.status-hero.is-pending .status-hero-icon { background: var(--amber-50); color: var(--amber-700); }

/* ---------- Admin KYC review ---------- */

.page-head { margin-bottom: var(--space-5); }
.page-head-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-top: 8px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); }
.back-link .icon { width: 16px; height: 16px; }
.review-layout { display: grid; gap: var(--space-5); align-items: start; }
@media (min-width: 1100px) { .review-layout { grid-template-columns: minmax(0, 1fr) 400px; } }
.doc-grid { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.doc { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.doc figcaption { display: flex; flex-direction: column; font-size: 14px; }
.doc-image { display: block; aspect-ratio: 4 / 3; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--bg); }
.doc-image img { width: 100%; height: 100%; object-fit: contain; transition: transform .2s; }
.doc-image:hover img { transform: scale(1.03); }
.doc-file {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; aspect-ratio: 4 / 3;
    border: 1px dashed var(--border-strong); border-radius: var(--radius); color: var(--ink-2); background: var(--bg);
}
.doc-file .icon { width: 28px; height: 28px; color: var(--muted); }
.reject-form { flex-direction: column; align-items: stretch; }

/* ---------- 2FA setup ---------- */

.two-factor-grid { display: grid; gap: var(--space-6); align-items: start; }
@media (min-width: 640px) { .two-factor-grid { grid-template-columns: auto 1fr; } }
.qr-box { justify-self: center; padding: 8px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }
.qr-box svg { width: 200px; height: 200px; }
.steps-list { margin: 0; padding-left: 20px; font-size: 14px; color: var(--ink-2); }
.steps-list li + li { margin-top: 6px; }
.recovery-codes { border-color: var(--amber-100); background: var(--amber-50); }
.code-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.code-grid li { padding: 8px 10px; font-family: var(--font-mono); font-size: 15px; text-align: center; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); }
@media (min-width: 640px) { .code-grid { grid-template-columns: repeat(4, 1fr); } }

/* ---------- Legal pages and holding page ---------- */

.legal { max-width: 720px; text-align: left; }
.legal > * + * { margin-top: var(--space-4); }
.legal h2 { margin-top: var(--space-8); }
.legal ul { padding-left: 20px; }
.legal li + li { margin-top: 6px; }
.minimal-main:has(.legal) { align-items: flex-start; }
.holding-actions { justify-content: center; margin-top: var(--space-6) !important; }

/* ---------- Payments (1.3.0) ---------- */

.test-strip {
    display: flex; align-items: center; justify-content: center; gap: 8px; padding: 6px var(--space-4);
    font-size: 13px; font-weight: 600; color: var(--amber-700);
    background: repeating-linear-gradient(-45deg, var(--amber-50), var(--amber-50) 10px, #FEF9E7 10px, #FEF9E7 20px);
    border-bottom: 1px solid var(--amber-100);
}
.test-strip .icon { width: 15px; height: 15px; }

.mode-switch { margin: 0; }
.mode-switch button {
    display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px;
    border: 1px solid var(--border); border-radius: var(--radius-pill); background: var(--surface);
    font: inherit; font-size: 13px; font-weight: 700; color: var(--green-700); cursor: pointer;
}
.mode-switch button[disabled] { cursor: not-allowed; opacity: .85; }
.mode-switch-track { position: relative; width: 34px; height: 20px; border-radius: 999px; background: #22C55E; transition: background-color .15s; }
.mode-switch-thumb { position: absolute; top: 2px; left: 16px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: left .15s; }
.mode-switch.is-test button { color: var(--amber-700); }
.mode-switch.is-test .mode-switch-track { background: #F59E0B; }
.mode-switch.is-test .mode-switch-thumb { left: 2px; }

.stat-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stat-grid-4 .stat-card { padding: var(--space-3) var(--space-4); }
.stat-grid-4 .stat-value { font-size: 17px; }
@media (min-width: 768px) {
    .stat-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .stat-grid-4 .stat-value { font-size: 20px; }
}

.bar-chart { display: flex; align-items: flex-end; gap: 6px; height: 160px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.bar-fill { display: block; width: 100%; max-width: 32px; border-radius: 6px 6px 2px 2px; background: var(--primary); min-height: 0; transition: background-color .15s; }
.bar:hover .bar-fill { background: var(--primary-hover); }
.bar-label { font-size: 11px; color: var(--subtle); font-variant-numeric: tabular-nums; }
.bar-fill[style*="height: 0%"] { height: 2px !important; background: var(--border); }

.tx-row { display: flex; justify-content: space-between; gap: 12px; width: 100%; color: inherit; }
.tx-row:hover { text-decoration: none; color: inherit; }
.tx-list li:has(.tx-row) { padding: 0; }
.tx-list .tx-row { padding: 12px var(--space-5); }
.tx-list .tx-row:hover { background: var(--bg); }

.filter-grid { display: grid; grid-template-columns: 1fr 1fr; }
.filter-grid > .input[type="search"] { grid-column: 1 / -1; }
.filter-grid .button-row { grid-column: 1 / -1; }
@media (min-width: 900px) {
    .filter-grid { grid-template-columns: 2fr 1fr 1fr 1fr 1fr auto; }
    .filter-grid > .input[type="search"], .filter-grid .button-row { grid-column: auto; }
}

.table-clickable tbody tr[data-href] { cursor: pointer; }
.table-clickable tbody tr[data-href] td a { color: inherit; }
td.is-credit { color: var(--green-700); }
td.is-debit { color: var(--ink-2); }
@media (max-width: 639px) { .hide-sm { display: none; } }

.payment-amount { font-size: 32px; font-weight: 700; letter-spacing: -.02em; }
.detail-grid { display: grid; gap: var(--space-5); align-items: start; margin-top: var(--space-5); }
@media (min-width: 1024px) { .detail-grid { grid-template-columns: minmax(0, 1fr) 380px; } }
.copy-inline { display: inline-flex; vertical-align: middle; padding: 2px; border: 0; background: none; color: var(--muted); cursor: pointer; }
.copy-inline .icon { width: 14px; height: 14px; }

.waiting-card { border-color: var(--amber-100); background: var(--amber-50); }
.waiting { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.waiting > div { flex: 1; min-width: 200px; }
.pulse { position: relative; flex: none; width: 14px; height: 14px; border-radius: 50%; background: #F59E0B; }
.pulse::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid #F59E0B; animation: pulse 1.6s ease-out infinite; }
@keyframes pulse { from { transform: scale(.6); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }

.timeline { list-style: none; margin: 0; padding: var(--space-4) var(--space-5); }
.timeline-item { position: relative; display: flex; gap: 12px; padding-bottom: 16px; font-size: 14px; }
.timeline-item:not(:last-child)::before { content: ""; position: absolute; left: 5px; top: 14px; bottom: 0; width: 2px; background: var(--border); }
.timeline-dot { flex: none; width: 12px; height: 12px; margin-top: 4px; border-radius: 50%; background: var(--border-strong); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--border-strong); }
.timeline-item.is-successful .timeline-dot { background: #22C55E; box-shadow: 0 0 0 1px #22C55E; }
.timeline-item.is-failed .timeline-dot, .timeline-item.is-expired .timeline-dot { background: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.timeline-item.is-processing .timeline-dot { background: #F59E0B; box-shadow: 0 0 0 1px #F59E0B; }

.input-amount { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.request-layout { display: grid; gap: var(--space-5); }
.test-numbers ul { margin: 0; padding-left: 18px; }
.test-numbers li + li { margin-top: 6px; }

.month-strip { display: grid; grid-template-columns: repeat(3, 1fr); }
.month-strip > div { display: flex; flex-direction: column; gap: 4px; padding: var(--space-4) var(--space-5); }
.month-strip > div + div { border-left: 1px solid var(--border); }
.month-strip strong { font-size: 18px; }

/* Email-only verification (1.3.1) */
.verify-hero { text-align: center; }
.verify-hero > * + * { margin-top: 8px; }

/* ---------- Developers, links, checkout (1.4.0) ---------- */

button.bottom-nav-item { border: 0; background: none; font: inherit; font-size: 11.5px; font-weight: 600; cursor: pointer; }

.segmented { display: inline-flex; padding: 3px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); }
.segmented a { padding: 6px 14px; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--muted); }
.segmented a:hover { text-decoration: none; color: var(--ink); }
.segmented a.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

.code-block-light { background: var(--bg); color: var(--ink); border: 1px solid var(--border); margin: 0; }
.code-block-light code { color: var(--ink); }
.is-blurred { filter: blur(5px); cursor: pointer; user-select: none; transition: filter .15s; }

.code-pre {
    margin: 0; padding: 16px var(--space-5); overflow-x: auto;
    background: var(--ink); color: #E2E8F0; font-family: var(--font-mono); font-size: 13px; line-height: 1.6;
    white-space: pre;
}
.card > .code-pre:last-child { border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.card-body .code-pre { border-radius: var(--radius); }
.code-pre code { padding: 0; background: none; border: 0; color: inherit; font-size: inherit; }

.code-tabs { border-top: 1px solid var(--border); }
.code-tab-list { display: flex; gap: 2px; padding: 8px var(--space-4) 0; background: #1E293B; overflow-x: auto; }
.code-tab-list button {
    padding: 8px 14px; border: 0; border-radius: 8px 8px 0 0; background: none; cursor: pointer;
    font: inherit; font-size: 13px; font-weight: 600; color: #94A3B8;
}
.code-tab-list button.is-active { background: var(--ink); color: #fff; }
.code-tabs .code-pre { border-radius: 0; }
.code-tabs:last-child .code-pre { border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

.docs > * + * { margin-top: var(--space-5); }
.docs code { font-size: 12.5px; }
.method { display: inline-block; min-width: 44px; padding: 1px 6px; border-radius: 5px; font-family: var(--font-mono); font-size: 11px; font-weight: 700; text-align: center; }
.method-get { background: var(--blue-50); color: var(--blue-700); }
.method-post { background: var(--green-50); color: var(--green-700); }

.keys-grid { align-items: start; }
.key-card.is-live { border-color: var(--green-100); }
.key-ips { flex-direction: column; align-items: stretch; }
.key-revoke { padding: 0 var(--space-5) var(--space-4); text-align: right; }
@media (min-width: 640px) { .key-revoke { padding: 0 var(--space-8) var(--space-4); } }
.secret-reveal { border-color: var(--amber-100); background: var(--amber-50); }

.link-list { list-style: none; margin: 0; padding: 0; }
.link-list li { display: flex; align-items: center; gap: 12px; padding: 12px var(--space-5); }
.link-list li + li { border-top: 1px solid var(--border); }
.link-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; color: var(--ink); }
.link-main:hover { text-decoration: none; }
.link-main:hover strong { color: var(--primary); }
.share-card { margin-bottom: var(--space-5); }
.share-card .code-block code { font-size: 14px; }
.share-card .button-row form { margin: 0; }

.choice-row-2 { grid-template-columns: 1fr 1fr !important; }
.advanced summary { cursor: pointer; font-size: 14px; font-weight: 600; color: var(--ink-2); }

/* Checkout: the page customers see */
.checkout { min-height: 100vh; background: linear-gradient(180deg, var(--red-50) 0, var(--bg) 220px); }
.checkout-shell { width: 100%; max-width: 440px; margin: 0 auto; padding: var(--space-6) var(--space-4) var(--space-8); }
.checkout-shell > * + * { margin-top: var(--space-4); }
.checkout-merchant { display: flex; align-items: center; gap: 12px; font-size: 17px; }
.checkout-merchant > div { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.checkout-avatar {
    display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; flex: none;
    border-radius: 12px; background: var(--ink); color: #fff; font-size: 18px; font-weight: 700;
}
.checkout-card .card-body { padding: var(--space-6); }
.checkout-amount { font-size: 34px; font-weight: 800; letter-spacing: -.02em; }
.checkout-description { margin-top: 6px; }
.checkout-center { text-align: center; }
.checkout-center .success-mark, .checkout-center .error-icon { margin: 0 auto; }
.checkout-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); }
.checkout-foot span, .checkout-foot a { display: inline-flex; align-items: center; gap: 6px; }
.checkout-foot .icon { width: 14px; height: 14px; }
.input-lg { font-size: 18px; min-height: 50px; }
.receipt { border-top: 1px solid var(--border); }
.phone-pulse {
    position: relative; display: inline-flex; align-items: center; justify-content: center; width: 72px; height: 72px; margin: 0 auto;
    border-radius: 50%; background: var(--red-50); color: var(--primary);
}
.phone-pulse .icon { width: 32px; height: 32px; }
.phone-pulse::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid var(--primary); animation: pulse 1.6s ease-out infinite; }

/* ---------- Withdrawals ---------- */

.timeline-item.is-completed .timeline-dot { background: #22C55E; box-shadow: 0 0 0 1px #22C55E; }
.timeline-item.is-rejected .timeline-dot, .timeline-item.is-cancelled .timeline-dot { background: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.timeline-item.is-pending_approval .timeline-dot, .timeline-item.is-queued .timeline-dot { background: #F59E0B; box-shadow: 0 0 0 1px #F59E0B; }

/* Dashboard earnings: today, yesterday, this week */
.earnings-grid .stat-card { padding: var(--space-4); }
.earnings-grid .stat-value { font-size: 18px; }
@media (min-width: 768px) { .earnings-grid .stat-value { font-size: 24px; } }

/* Admin: fees and live balances */
.fees-grid .stat-card.is-highlight { background: var(--ink); border-color: var(--ink); }
.fees-grid .stat-card.is-highlight .stat-label, .fees-grid .stat-card.is-highlight .stat-meta { color: #CBD5E1; }
.fees-grid .stat-card.is-highlight .stat-value { color: #fff; }
@media (min-width: 1200px) { .fees-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.live-indicator { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #22C55E; box-shadow: 0 0 0 3px rgba(34, 197, 94, .2); animation: live-pulse 2s infinite; }
@keyframes live-pulse { 50% { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); } }
tr.is-changed td { animation: row-flash 3s ease-out; }
@keyframes row-flash { 0% { background: #FEF9C3; } 100% { background: transparent; } }
@media (prefers-reduced-motion: reduce) { .live-dot, tr.is-changed td { animation: none; } }

/* Inline menus inside scrolling tables open in place instead of floating */
.inline-menu.is-static .inline-menu-panel { position: static; width: 260px; margin: 8px 0 0 auto; box-shadow: none; }
.permission-group { border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-4); }
.permission-group legend { padding: 0 6px; font-weight: 600; text-transform: capitalize; }
.permission-grid { display: grid; gap: 8px; grid-template-columns: 1fr; }
@media (min-width: 768px) { .permission-grid { grid-template-columns: 1fr 1fr; } }
.template-body { font-family: var(--font-mono); font-size: 13.5px; line-height: 1.6; min-height: 320px; }
.template-preview { white-space: pre-wrap; font-size: 14px; line-height: 1.6; padding: var(--space-4); background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); }
.var-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.var-chips code { padding: 2px 8px; border-radius: var(--radius-pill); background: var(--bg); border: 1px solid var(--border); font-size: 12.5px; cursor: pointer; }

/* =====================================================================
   Public website (layouts/site.php)
   ===================================================================== */

body.site { background: var(--surface); }
.site-container { width: 100%; max-width: 1140px; margin: 0 auto; padding: 0 var(--space-4); }
@media (min-width: 768px) { .site-container { padding: 0 var(--space-6); } }
.site-narrow { max-width: 760px; }

.site-header { position: sticky; top: 0; z-index: 40; background: rgba(255, 255, 255, .92); backdrop-filter: saturate(180%) blur(10px); border-bottom: 1px solid var(--border); }
.site-header-inner { display: flex; align-items: center; gap: var(--space-5); height: 68px; }
.site-header .brand-name { font-size: 20px; font-weight: 700; }
.site-nav { display: none; gap: var(--space-5); margin-left: var(--space-4); }
.site-nav a { color: var(--ink-2); font-weight: 500; font-size: 15px; }
.site-nav a:hover, .site-nav a[aria-current] { color: var(--primary); text-decoration: none; }
.site-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.site-menu { position: relative; }
.site-menu summary { list-style: none; }
.site-menu summary::-webkit-details-marker { display: none; }

.hero { padding: 56px 0 40px; background: radial-gradient(1200px 400px at 85% -10%, var(--red-50), transparent 60%); }
.hero-grid { display: grid; gap: 48px; align-items: center; }
@media (min-width: 960px) { .hero { padding: 88px 0 64px; } .hero-grid { grid-template-columns: 1.1fr .9fr; } }
.hero-title { font-size: 36px; line-height: 1.1; font-weight: 800; letter-spacing: -.03em; color: var(--ink); margin: 0 0 var(--space-4); }
@media (min-width: 768px) { .hero-title { font-size: 52px; } }
.hero-lead { font-size: 18px; line-height: 1.6; color: var(--ink-2); max-width: 580px; margin: 0 0 var(--space-6); }
.hero-points { list-style: none; padding: 0; margin: var(--space-6) 0 0; display: flex; flex-wrap: wrap; gap: 10px 22px; color: var(--ink-2); font-size: 14px; }
.hero-points li { display: inline-flex; align-items: center; gap: 6px; }
.hero-points .icon { color: var(--green-700); width: 16px; height: 16px; }

.hero-visual { position: relative; display: flex; justify-content: center; padding: 10px 0 30px; }
.phone { width: 260px; height: 520px; padding: 14px; border-radius: 40px; background: #0F172A; box-shadow: var(--shadow-lg), inset 0 0 0 2px #334155; }
.phone-screen { height: 100%; border-radius: 28px; background: linear-gradient(180deg, #E11D2E 0%, #B91C1C 100%); padding: 40px 16px; display: flex; flex-direction: column; align-items: center; }
.phone-network { color: #fff; font-weight: 700; letter-spacing: .04em; margin: 0 0 24px; }
.phone-prompt { width: 100%; background: #fff; border-radius: 14px; padding: 16px; font-size: 14px; line-height: 1.5; color: var(--ink); box-shadow: 0 10px 30px rgba(0, 0, 0, .25); }
.phone-prompt p { margin: 0 0 8px; }
.phone-pin { margin: 10px 0 14px; padding: 10px; border: 1px solid var(--border-strong); border-radius: 8px; letter-spacing: .4em; text-align: center; }
.phone-buttons { display: flex; justify-content: space-between; font-weight: 700; color: var(--primary); }
.hero-toast { position: absolute; right: 0; bottom: 70px; display: flex; gap: 10px; align-items: center; padding: 12px 16px; background: #fff; border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); font-size: 14px; }
@media (min-width: 960px) { .hero-toast { right: -10px; } }
.hero-toast-icon { display: inline-flex; width: 34px; height: 34px; align-items: center; justify-content: center; border-radius: 50%; background: var(--green-50); color: var(--green-700); }

.networks { padding: var(--space-6) 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); text-align: center; }
.network-list { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 28px; font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.net-mpesa { color: #E60000; }
.net-mixx { color: #0057B8; }
.net-airtel { color: #ED1C24; }
.net-halo { color: #F7941D; }

.site-section { padding: 64px 0; }
@media (min-width: 768px) { .site-section { padding: 88px 0; } }
.site-section-alt { background: var(--bg); }
.section-head { max-width: 680px; margin-bottom: var(--space-8); }
.section-title { font-size: 28px; line-height: 1.2; font-weight: 800; letter-spacing: -.02em; color: var(--ink); margin: 0 0 var(--space-3); }
@media (min-width: 768px) { .section-title { font-size: 36px; } }

.step-cards { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--space-5); }
@media (min-width: 768px) { .step-cards { grid-template-columns: repeat(3, 1fr); } .step-cards-4 { grid-template-columns: repeat(4, 1fr); } }
.step-card { padding: var(--space-6); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.step-card .h3 { margin: var(--space-4) 0 var(--space-2); }
.step-card p { margin: 0; }
.step-number { display: inline-flex; width: 36px; height: 36px; align-items: center; justify-content: center; border-radius: 50%; background: var(--primary); color: #fff; font-weight: 700; }

.feature-grid { display: grid; gap: var(--space-5); }
@media (min-width: 640px) { .feature-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .feature-grid { grid-template-columns: repeat(3, 1fr); } }
.feature-card { padding: var(--space-6); border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); }
.feature-card .h3 { margin: var(--space-4) 0 var(--space-2); }
.feature-card p { margin: 0; line-height: 1.6; }
.feature-icon { display: inline-flex; width: 44px; height: 44px; align-items: center; justify-content: center; border-radius: 12px; background: var(--red-50); color: var(--primary); }

.dev-grid { display: grid; gap: var(--space-8); align-items: center; }
@media (min-width: 960px) { .dev-grid { grid-template-columns: 1fr 1fr; } }
.dev-code { border-radius: var(--radius-lg); font-size: 13px; }
.check-list { list-style: none; padding: 0; margin: var(--space-5) 0 0; display: grid; gap: 10px; }
.check-list li { display: flex; gap: 8px; align-items: center; color: var(--ink-2); }
.check-list .icon { color: var(--green-700); flex: none; }

.faq-list { display: grid; gap: 10px; }
.faq { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0 var(--space-5); }
.faq summary { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: var(--space-4) 0; cursor: pointer; font-weight: 600; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary .icon { flex: none; transition: transform .15s; }
.faq[open] summary .icon { transform: rotate(180deg); }
.faq p { margin: 0 0 var(--space-4); line-height: 1.6; }

.cta { padding: 64px 0; background: linear-gradient(135deg, #E11D2E 0%, #9F1239 100%); color: #fff; }
.cta-inner { display: flex; flex-wrap: wrap; gap: var(--space-6); align-items: center; justify-content: space-between; }
.cta .section-title { color: #fff; }
.cta p { margin: 0; color: #FEE2E2; font-size: 17px; }

.page-hero { padding: 56px 0 24px; background: radial-gradient(1000px 300px at 90% -20%, var(--red-50), transparent 60%); }
@media (min-width: 768px) { .page-hero { padding: 80px 0 32px; } }
.page-hero-small { padding-bottom: 8px; }
.page-hero-small .hero-title { font-size: 34px; }

.contact-grid { display: grid; gap: var(--space-5); }
@media (min-width: 640px) { .contact-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .contact-grid { grid-template-columns: repeat(4, 1fr); } }
.contact-card { display: flex; flex-direction: column; gap: 6px; padding: var(--space-6); border: 1px solid var(--border); border-radius: var(--radius-lg); color: var(--ink); transition: border-color .15s, box-shadow .15s; }
.contact-card:hover { border-color: var(--primary); box-shadow: var(--shadow); text-decoration: none; }
.contact-card .feature-icon { margin-bottom: 8px; }

.docs-layout { display: grid; gap: var(--space-6); padding-top: var(--space-6); padding-bottom: 80px; }
@media (min-width: 1024px) { .docs-layout { grid-template-columns: 230px minmax(0, 1fr); gap: 48px; } }
.docs-toc { display: none; }
@media (min-width: 1024px) { .docs-toc { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 92px; align-self: start; max-height: calc(100vh - 110px); overflow-y: auto; font-size: 14px; } }
.docs-toc-title { margin: 0 0 8px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.docs-toc a { padding: 4px 0; color: var(--ink-2); }
.docs-toc a:hover { color: var(--primary); text-decoration: none; }
.docs-toc .docs-toc-3 { padding-left: 14px; font-size: 13px; color: var(--muted); }
.doc-article { min-width: 0; font-size: 15.5px; line-height: 1.7; color: var(--ink-2); }
.doc-article h2 { margin: 48px 0 12px; padding-top: 8px; font-size: 26px; color: var(--ink); letter-spacing: -.01em; scroll-margin-top: 90px; }
.doc-article h3 { margin: 32px 0 10px; font-size: 19px; color: var(--ink); scroll-margin-top: 90px; }
.doc-article h4 { margin: 24px 0 8px; font-size: 16px; color: var(--ink); }
.doc-article p, .doc-article ul, .doc-article ol { margin: 0 0 14px; }
.doc-article code { font-family: var(--font-mono); font-size: .9em; padding: 1px 6px; border-radius: 6px; background: var(--bg); border: 1px solid var(--border); }
.doc-article pre code { padding: 0; border: 0; background: none; font-size: 13px; color: inherit; }
.doc-article pre { margin: 0 0 18px; border-radius: var(--radius); }
.doc-article .table-wrap { margin: 0 0 18px; border: 1px solid var(--border); border-radius: var(--radius); }
.doc-article hr { margin: 40px 0; border: 0; border-top: 1px solid var(--border); }
.doc-article blockquote { margin: 0 0 14px; padding: 10px 16px; border-left: 3px solid var(--primary); background: var(--red-50); }

.site-footer { padding: 56px 0 24px; background: var(--bg); border-top: 1px solid var(--border); }
.site-footer-grid { display: grid; gap: var(--space-6); grid-template-columns: repeat(2, 1fr); }
.site-footer-grid > div:first-child { grid-column: 1 / -1; }
@media (min-width: 768px) { .site-footer-grid { grid-template-columns: 2fr 1fr 1fr 1fr; } .site-footer-grid > div:first-child { grid-column: auto; } }
.site-footer-grid a:not(.brand) { display: block; padding: 4px 0; color: var(--ink-2); font-size: 14px; }
.site-footer-title { margin: 0 0 8px; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.site-footer-bottom { margin-top: var(--space-8); padding-top: var(--space-5); border-top: 1px solid var(--border); }

body.site .legal { margin: 0 auto; padding: 56px var(--space-4) 80px; }

/* Site header: logo and menu button on phones, full navigation from 900px */
.site-header .brand { flex: none; white-space: nowrap; }
.site-header .brand-name { white-space: nowrap; }
.site-actions { display: none; }
.site-menu { margin-left: auto; }
.site-menu-toggle {
    display: inline-flex; width: 44px; height: 44px; align-items: center; justify-content: center;
    border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--ink); cursor: pointer;
}
.site-menu-close { display: none; }
.site-menu[open] .site-menu-open { display: none; }
.site-menu[open] .site-menu-close { display: inline-flex; }
.site-menu[open] .site-menu-toggle { background: var(--bg); }
.site-menu-panel {
    position: fixed; left: 0; right: 0; top: 68px; z-index: 50;
    display: flex; flex-direction: column; gap: 20px;
    max-height: calc(100vh - 68px); overflow-y: auto; padding: 8px 16px 24px;
    background: var(--surface); border-bottom: 1px solid var(--border);
    box-shadow: 0 24px 40px -16px rgba(15, 23, 42, .25);
}
.site-menu-links { display: flex; flex-direction: column; }
.site-menu-links a {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 4px; border-bottom: 1px solid var(--border);
    font-size: 17px; font-weight: 600; color: var(--ink);
}
.site-menu-links a:hover { color: var(--primary); text-decoration: none; }
.site-menu-links a .icon { color: var(--subtle); }
.site-menu-buttons { display: grid; gap: 10px; }
@media (min-width: 900px) {
    .site-nav { display: flex; }
    .site-actions { display: flex; }
    .site-menu { display: none; }
}

/* Call-to-action band buttons */
.cta .cta-btn { --btn-bg: #fff; --btn-fg: var(--primary); --btn-border: #fff; }
.cta .cta-btn:hover { --btn-bg: #FFF1F2; text-decoration: none; }
.cta .cta-btn-ghost { --btn-bg: transparent; --btn-fg: #fff; --btn-border: rgba(255, 255, 255, .7); }
.cta .cta-btn-ghost:hover { --btn-bg: rgba(255, 255, 255, .12); text-decoration: none; }

/* Phones: main buttons full width, stacked */
@media (max-width: 639px) {
    .hero-copy .button-row, .cta .button-row, .page-hero .button-row { width: 100%; flex-direction: column; align-items: stretch; }
    .hero-copy .button-row .btn, .cta .button-row .btn, .page-hero .button-row .btn { width: 100%; }
    .hero { padding-top: 40px; }
    .hero-title { font-size: 34px; }
    .hero-lead { font-size: 17px; }
    .cta-inner { flex-direction: column; align-items: stretch; text-align: left; }
    .hero-toast { right: 8px; bottom: 50px; }
}

/* ---------- Merchant dashboard on phones ---------- */

/* Bottom navigation: five equal slots, labels never wrap or push items off screen */
.bottom-nav-item { min-width: 0; }
.bottom-nav-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 639px) {
    /* Earnings: one row each (label left, amount right) so long amounts always fit */
    .earnings-grid { grid-template-columns: 1fr; gap: 8px; }
    .earnings-grid .stat-card { flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; }
    .earnings-grid .stat-label { font-size: 14px; }
    .earnings-grid .stat-value { font-size: 18px; white-space: nowrap; }

    .page-greeting { margin-bottom: var(--space-3); }
    .page-head-row.mb-4 { margin-bottom: var(--space-3); }
    .balance-card { padding: var(--space-4) var(--space-5); }
    .balance-value { font-size: 28px; }
    .balance-card .button-row .btn { flex: 1 1 auto; }

    .topbar { height: 56px; gap: 10px; }
    .topbar-title { font-size: 16px; }
    .banner { padding: 10px var(--space-4); font-size: 13.5px; line-height: 1.45; gap: 6px 10px; }

    .card-section-head { padding-left: var(--space-4); padding-right: var(--space-4); }
    .tx-list .tx-row { padding: 12px var(--space-4); }
    .tx-main { min-width: 0; }
    .tx-main strong, .tx-main span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .tx-side { flex: none; }

    .bar-chart { gap: 3px; }
    .bar-label { font-size: 10px; }
}

/* ---------- All dashboard pages on phones ---------- */

/* Shown only on phones (e.g. the date under a customer when the Date column is hidden) */
.show-sm { display: none; }

/* Step titles in multi-step forms sit inside the card, not on its top border */
.wizard-step > legend { float: left; width: 100%; padding: 0; }
.wizard-step > legend + * { clear: both; }

/* Short codes in tables never break in the middle */
.table code { white-space: nowrap; }

@media (max-width: 639px) {
    .show-sm { display: block; }
    span.show-sm.badge { display: inline-flex; margin-top: 4px; }

    /* Page headings with several buttons: text on top, buttons share the row below */
    .page-head-row { flex-wrap: wrap; }
    .page-head-row > .button-row { flex: 1 1 100%; }
    .page-head-row > .button-row > .btn, .page-head-row > .button-row > form { flex: 1 1 0; }
    .page-head-row > .button-row > form .btn { width: 100%; }

    /* Tables: tighter cells, long IDs shortened with … */
    .table th, .table td { padding-left: 12px; padding-right: 12px; }
    .table td .mono { display: inline-block; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }

    /* Copy boxes (payment link, API key, base URL): show the whole value, button underneath */
    .code-block { flex-wrap: wrap; }
    .code-block code { flex: 1 1 100%; white-space: normal; word-break: break-all; overflow: visible; }
    .code-block .btn { flex: 1 1 auto; }

    /* Code samples wrap instead of scrolling sideways */
    .code-pre, .code-pre code { white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; }

    /* Section tabs fit the screen */
    .tab { padding: 10px 10px; font-size: 13.5px; }
}

/* ---------- Admin panel on phones ---------- */

@media (max-width: 639px) {
    /* Each table row becomes a card: first cell is the title, the rest are "Label  value" lines */
    .table.is-labeled thead { display: none; }
    .table.is-labeled, .table.is-labeled tbody, .table.is-labeled tr { display: block; width: 100%; }
    .table.is-labeled tr { padding: 12px var(--space-4); border-bottom: 1px solid var(--border); }
    .table.is-labeled tbody tr:last-child { border-bottom: 0; }
    .table.is-labeled td {
        display: block; padding: 3px 0; border: 0; text-align: right; white-space: normal; background: none; overflow: hidden;
    }
    .table.is-labeled td::before {
        content: attr(data-label); float: left; max-width: 45%; margin-right: 12px; text-align: left;
        font-size: 12px; font-weight: 600; color: var(--muted);
    }
    .table.is-labeled td:first-child { display: block; padding-bottom: 6px; text-align: left; font-size: 15px; }
    .table.is-labeled td:first-child::before,
    .table.is-labeled td:not([data-label])::before { content: none; }
    .table.is-labeled td.hide-sm, .table.is-labeled td:empty { display: none; }
    .table.is-labeled td.num { text-align: right; }
    .table.is-labeled tbody tr:hover td { background: none; }
    .table.is-labeled td .inline-menu.is-static { width: 100%; }
    .table.is-labeled td .inline-menu.is-static summary { margin-left: auto; }
    .table.is-labeled td .inline-menu.is-static .inline-menu-panel { width: 100%; }

    /* Filters: search on its own line, the rest share the next line */
    .admin .filter-bar .filter-search { flex: 1 1 100%; }
    .admin .filter-bar .select { flex: 1 1 auto; }
    .admin .filter-bar .btn { flex: 1 1 auto; }

    /* Inline forms with a fixed-width field (fees, reasons) use the full width */
    .admin .button-row > .input, .admin .button-row > .input-affix { flex: 1 1 100% !important; max-width: none !important; }
    .admin .input-affix[style] { max-width: none !important; }

    /* Page heads and stats */
    .admin .page-head-row { flex-wrap: wrap; }
    .admin .page-head-row > .button-row { flex: 1 1 100%; }
    .admin .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
    .admin .stat-card { padding: var(--space-3) var(--space-4); }
    .admin .stat-value { font-size: 18px; overflow-wrap: anywhere; }
    .admin .fees-grid .stat-card.is-highlight { grid-column: 1 / -1; }

    /* Long values (URLs, IDs, JSON) never push the page sideways */
    .admin .summary-row dd, .admin .activity-list span { overflow-wrap: anywhere; }
    .admin pre, .admin .log-details pre { white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; }
    .admin .env-badge { padding: 2px 8px; font-size: 11px; }
    .admin .h2 { font-size: 20px; }
}

/* Inputs with a unit after them ("10 %"): the input may shrink, the unit closes the box */
.input-affix .input { min-width: 0; }
.input-affix .input:has(+ .input-prefix) { border-radius: var(--radius) 0 0 var(--radius); }
.input-affix .input + .input-prefix { border-left: 0; border-right: 1px solid var(--border-strong); border-radius: 0 var(--radius) var(--radius) 0; }

/* ---------- Final phone polish: tabs, long headings, docs ---------- */

@media (max-width: 639px) {
    /* Tabs become wrapping pills so every option is visible without sideways scrolling */
    .tabs { flex-wrap: wrap; gap: 6px; overflow: visible; border-bottom: 0; }
    .tabs .tab {
        margin: 0; padding: 7px 12px; border: 1px solid var(--border); border-radius: var(--radius-pill);
        background: var(--surface); font-size: 13px;
    }
    .tabs .tab.is-active { border-color: var(--primary); background: var(--red-50); color: var(--primary-hover); }
    .tabs .tab-count { margin-left: 4px; }

    /* Codes inside card rows may wrap (e.g. "amount_too_low / amount_too_high") */
    .table.is-labeled code { white-space: normal; overflow-wrap: anywhere; }

    /* Long headings (API log URLs, business names) wrap instead of overflowing */
    .page-head-row h2, .page-head-row .h2, .payment-amount { overflow-wrap: anywhere; min-width: 0; }
    .page-head-row > div { min-width: 0; }

    /* Public API docs: tables are cards; give them the same frame as other cards */
    .doc-article .table-wrap { overflow: visible; }
    .doc-article h2 { font-size: 22px; }

    /* Customer payment page and sign-in cards: comfortable side padding */
    .checkout-shell { padding-left: var(--space-4); padding-right: var(--space-4); }
    .auth-card .card-body { padding: var(--space-5); }

    /* Admin KYC documents: one per row so photos are large enough to check */
    .doc-grid { grid-template-columns: 1fr; }
}

/* Settings › Team */
.team-list { list-style: none; margin: 0; padding: 0; }
.team-member { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px; padding: 14px var(--space-5); border-top: 1px solid var(--border); }
.team-member:first-child { border-top: 0; }
.team-member.is-disabled { opacity: .6; }
.team-member-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.team-member-main strong, .team-member-main .muted { overflow-wrap: anywhere; }
.team-actions { margin-left: auto; }
.team-actions[open] { flex: 1 1 100%; }
@media (max-width: 639px) { .team-member { padding: 14px var(--space-4); } }

/* Payment link page: pay box code and live preview side by side */
.paybox-layout { display: grid; gap: var(--space-6); align-items: start; }
@media (min-width: 960px) { .paybox-layout { grid-template-columns: minmax(0, 1fr) 420px; } }

/* Admin overview: recent transactions */
.txn-item { gap: 4px; }
.txn-item-main { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; color: inherit; text-decoration: none; }
.txn-item-main strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.txn-item-main:hover strong { color: var(--primary); }
.txn-item-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
