/* Moov Money Benin - merchant payment POC */

:root {
    --bg: #f4f6f8;
    --surface: #ffffff;
    --ink: #14202b;
    --ink-soft: #5a6b7b;
    --line: #dde4ea;
    --brand: #f36f21;      /* Moov orange */
    --brand-dark: #d4590f;
    --error: #b3261e;
    --error-bg: #fdecea;
    --info: #0b5d8a;
    --info-bg: #e7f2f9;
    --radius: 10px;
}

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

body {
    margin: 0;
    padding: 2rem 1rem 3rem;
    background: var(--bg);
    color: var(--ink);
    font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.shell { max-width: 560px; margin: 0 auto; }

.shell__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .9rem;
    margin-bottom: 1.5rem;
}

.brand {
    display: grid;
    place-items: center;
    width: 46px; height: 46px;
    flex: 0 0 46px;
    border-radius: 12px;
    background: var(--brand);
    color: #fff;
    font-weight: 700;
    letter-spacing: .5px;
}

.shell__head h1 { margin: 0; font-size: 1.3rem; line-height: 1.2; }
.shell__sub { margin: .15rem 0 0; color: var(--ink-soft); font-size: .85rem; }

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.card__intro { margin: 0 0 1.5rem; color: var(--ink-soft); font-size: .92rem; }
.card__note { margin: 1rem 0 0; color: var(--ink-soft); font-size: .82rem; text-align: center; }

/* ---------- fields ---------- */

.field { margin-bottom: 1.35rem; }

.field label {
    display: block;
    margin-bottom: .4rem;
    font-weight: 600;
    font-size: .92rem;
}

.req { color: var(--brand); }

.field input {
    width: 100%;
    padding: .7rem .85rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: inherit;
    font: inherit;
}

.field input:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 1px;
    border-color: var(--brand);
}

.field--invalid input { border-color: var(--error); }

/* prefix / suffix wrapper (+229 … XOF) */
.field__prefixed {
    display: flex;
    align-items: stretch;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.field__prefixed:focus-within {
    outline: 2px solid var(--brand);
    outline-offset: 1px;
    border-color: var(--brand);
}

.field--invalid .field__prefixed { border-color: var(--error); }

.field__prefixed input {
    border: 0;
    border-radius: 0;
    flex: 1 1 auto;
    min-width: 0;
}

.field__prefixed input:focus-visible { outline: none; }

.field__prefix, .field__suffix {
    display: grid;
    place-items: center;
    padding: 0 .85rem;
    background: #f0f3f6;
    color: var(--ink-soft);
    font-size: .9rem;
    font-weight: 600;
    white-space: nowrap;
}

.field__prefix { border-right: 1px solid var(--line); }
.field__suffix { border-left: 1px solid var(--line); }

.field__help { margin: .4rem 0 0; color: var(--ink-soft); font-size: .8rem; }
.field__error { margin: .4rem 0 0; color: var(--error); font-size: .82rem; font-weight: 600; }

/* hide the number spinner: amounts are typed, not stepped */
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ---------- advanced block ---------- */

.advanced {
    margin: 0 0 1.35rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: .75rem 1rem;
    background: #fafbfc;
}

.advanced summary {
    cursor: pointer;
    font-weight: 600;
    font-size: .9rem;
    color: var(--ink-soft);
}

.advanced[open] summary { margin-bottom: 1rem; }
.advanced .field:last-child { margin-bottom: .25rem; }

/* ---------- buttons ---------- */

.btn {
    display: block;
    width: 100%;
    padding: .85rem 1rem;
    border: 1px solid var(--brand);
    border-radius: 8px;
    background: var(--brand);
    color: #fff;
    font: inherit;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

.btn:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.btn--ghost {
    background: transparent;
    color: var(--brand-dark);
    border-color: var(--line);
}

.btn--ghost:hover { background: #fff5ef; border-color: var(--brand); color: var(--brand-dark); }

/* ---------- alerts ---------- */

.alert {
    margin: 0 0 1.35rem;
    padding: .9rem 1rem;
    border-radius: 8px;
    border-left: 4px solid;
    font-size: .9rem;
}

.alert__title { margin: 0 0 .35rem; font-weight: 700; }
.alert p:last-child { margin-bottom: 0; }
.alert ul { margin: 0; padding-left: 1.15rem; }

.alert--error { background: var(--error-bg); border-color: var(--error); color: #7d1a15; }
.alert--info { background: var(--info-bg); border-color: var(--info); color: #08465f; }
.alert--success { background: #e6f5ea; border-color: #1c6b32; color: #145226; }

/* ---------- recap ---------- */

.recap { margin: 0 0 1.5rem; }

.recap__row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: .5rem;
    padding: .7rem 0;
    border-bottom: 1px solid var(--line);
}

.recap__row:last-child { border-bottom: 0; }
.recap dt { color: var(--ink-soft); font-size: .88rem; }
.recap dd { margin: 0; font-weight: 600; text-align: right; word-break: break-all; }
.recap__row--strong dd { color: var(--brand-dark); font-size: 1.15rem; }

code {
    background: #eef1f4;
    padding: .1rem .35rem;
    border-radius: 4px;
    font-size: .85em;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

/* ---------- footer ---------- */

.shell__foot {
    margin-top: 1.25rem;
    text-align: center;
    color: var(--ink-soft);
    font-size: .78rem;
}

.shell__foot p { margin: 0; }

/* ==================================================================
   Back-office - transaction history (admin only)
   ================================================================== */

.body--admin { padding-bottom: 2rem; }

.shell--wide { max-width: 1100px; }

.shell__head .session {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: .75rem;
    font-size: .82rem;
    color: var(--ink-soft);
}

.session__user { white-space: nowrap; }
.session a { color: var(--brand-dark); }

.brand--admin { background: var(--ink); }

.btn--link {
    display: inline;
    width: auto;
    padding: 0;
    border: 0;
    background: none;
    color: var(--brand-dark);
    font-size: .82rem;
    text-decoration: underline;
}

.btn--link:hover { background: none; color: var(--error); }

.btn--compact {
    display: inline-block;
    width: auto;
    padding: .5rem 1rem;
    font-size: .88rem;
}

/* ---------- summary tiles ---------- */

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: .75rem;
    margin-bottom: 1rem;
}

.stat {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: .8rem 1rem;
}

.stat__label {
    display: block;
    color: var(--ink-soft);
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.stat__value {
    display: block;
    margin-top: .2rem;
    font-size: 1.25rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.stat--strong .stat__value { color: var(--brand-dark); }

/* ---------- filter bar ---------- */

.filters { margin-bottom: 1rem; padding: 1.1rem 1.25rem; }

.filters__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0 1rem;
}

.filters .field { margin-bottom: .9rem; }

.filters select {
    width: 100%;
    padding: .7rem .85rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: inherit;
    font: inherit;
}

.filters select:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 1px;
    border-color: var(--brand);
}

.filters__actions {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    align-items: center;
}

/* ---------- history table ---------- */

.card--table { padding: 0; overflow: hidden; }

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

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

.table th, .table td {
    padding: .7rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

.table thead th {
    background: #f7f9fb;
    color: var(--ink-soft);
    font-size: .76rem;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fbfcfd; }

.table__num { text-align: right; font-variant-numeric: tabular-nums; }
.table__actions { text-align: right; }
.table__mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .82rem; }

.empty { margin: 0; padding: 2.5rem 1.5rem; text-align: center; color: var(--ink-soft); }

/* ---------- status badge ---------- */

.badge {
    display: inline-block;
    padding: .15rem .55rem;
    border-radius: 999px;
    font-size: .76rem;
    font-weight: 700;
    white-space: nowrap;
}

.badge--pending { background: #fff3e0; color: #8a4b00; }
.badge--success { background: #e6f5ea; color: #1c6b32; }
.badge--failed  { background: var(--error-bg); color: #7d1a15; }
.badge--error   { background: #ece9f5; color: #43377a; }
.badge--unknown { background: #eef1f4; color: var(--ink-soft); }

/* ---------- pagination ----------
   Markup comes from CodeIgniter's default_full pager view: a <nav> wrapping
   <ul class="pagination">, the current page carrying `li.active`. */

.pager { padding: .9rem 1rem; border-top: 1px solid var(--line); }

.pager ul.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: .3rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.pager li a {
    display: block;
    padding: .3rem .65rem;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--ink-soft);
    text-decoration: none;
    font-size: .85rem;
    white-space: nowrap;
}

.pager li a:hover { border-color: var(--brand); color: var(--brand-dark); }
.pager li a:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }

.pager li.active a {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
    font-weight: 700;
}

/* ---------- detail page ---------- */

.breadcrumb { margin: 0 0 1rem; font-size: .85rem; }
.breadcrumb a { color: var(--ink-soft); text-decoration: none; }
.breadcrumb a:hover { color: var(--brand-dark); text-decoration: underline; }

.shell--wide .card + .card { margin-top: 1rem; }

.detail__head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: 1.25rem;
}

.detail__title { margin: 0; font-size: 1.1rem; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; word-break: break-all; }
.detail__sub { margin: .2rem 0 0; color: var(--ink-soft); font-size: .82rem; }
.detail__error { color: var(--error); }

.card__title { margin: 0 0 1rem; font-size: 1rem; }

.envelope {
    margin: 0;
    padding: .9rem;
    max-height: 22rem;
    overflow: auto;
    background: #f7f9fb;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: .78rem;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
}

.envelope code { background: none; padding: 0; font-size: inherit; }

/* ---------- accessibility ---------- */

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