/* =========================================================
   Member portal — mobile-first "bank app" theme.
   Dark brand hero that bleeds from the top, lime action pills,
   circular quick actions, and a floating tab bar with a centre
   chat button. Uses each SACCO's own --brand colour (set inline
   in the header), so the whole app re-themes per SACCO.
   ========================================================= */
@font-face {
    font-family: "Montserrat";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("../fonts/Montserrat.woff2") format("woff2");
}

:root {
    --brand: #2563eb;
    --brand-deep: #1d4ed8;

    /* Hero gradient, derived from the SACCO's brand colour */
    --hero-1: color-mix(in srgb, var(--brand) 88%, black);
    --hero-2: color-mix(in srgb, var(--brand) 62%, black);
    --hero-line: color-mix(in srgb, white 16%, transparent);

    /* Bright action accent (lime), the app's "do it" colour */
    --accent: #bef264;
    --accent-ink: #1a2e05;

    --ink: #0f172a;
    --muted: #64748b;
    --faint: #94a3b8;
    --line: #e8ecf3;
    --bg: #f4f6fa;
    --surface: #ffffff;
    --green: #16a34a;
    --green-bg: #e9f9ef;
    --red: #ef4444;
    --red-bg: #fdecec;
    --amber: #d97706;
    --amber-bg: #fdf3e0;
    --violet: #7c3aed;
    --violet-bg: #f1edfd;
    --blue: #2563eb;
    --blue-bg: #e8f0ff;
    --radius: 18px;
    --shadow: 0 1px 2px rgba(15,23,42,.04), 0 6px 20px rgba(15,23,42,.06);
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: "Montserrat", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
    font-variant-numeric: tabular-nums;
}
a { text-decoration: none; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 800; letter-spacing: -0.02em; }

.portal-shell { max-width: 520px; margin: 0 auto; min-height: 100vh; background: var(--bg); padding-bottom: 112px; }

/* =========================================================
   Hero — dark brand panel bleeding from the top
   ========================================================= */
.phero {
    background: linear-gradient(160deg, var(--hero-1), var(--hero-2));
    color: #fff;
    border-radius: 0 0 30px 30px;
    padding: 18px 18px 22px;
    position: relative;
    overflow: hidden;
}
.phero::after {
    content: ""; position: absolute; right: -60px; top: -70px;
    width: 210px; height: 210px; border-radius: 50%;
    background: rgba(255,255,255,.06);
}
.phero-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; position: relative; z-index: 1; }
.phero-id { display: flex; align-items: center; gap: 11px; min-width: 0; }
.phero-av {
    width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0;
    background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.22);
    display: grid; place-items: center; font-weight: 800; font-size: 14px; color: #fff;
}
.phero-hi { font-size: 12.5px; opacity: .78; line-height: 1.2; }
.phero-hi b { display: block; font-size: 15.5px; opacity: 1; font-weight: 800; margin-top: 1px; }
.phero-bell {
    width: 42px; height: 42px; border-radius: 14px; flex-shrink: 0;
    background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.2);
    display: grid; place-items: center; color: #fff; position: relative;
}
.phero-bell svg { width: 19px; height: 19px; }
.phero-bell .dot {
    position: absolute; top: 9px; right: 10px; width: 8px; height: 8px;
    border-radius: 50%; background: var(--accent); border: 1.5px solid var(--hero-1);
}

/* Balance block */
.phero-bal { text-align: center; margin-top: 22px; position: relative; z-index: 1; }
.phero-bal .lbl { font-size: 12.5px; color: var(--accent); font-weight: 700; letter-spacing: .02em; }
.phero-bal .amt { font-size: 33px; font-weight: 800; margin: 5px 0 3px; letter-spacing: -0.02em; }
.phero-bal .sub { font-size: 12px; opacity: .72; }

/* Action pills */
.phero-actions { display: flex; gap: 10px; justify-content: center; margin-top: 18px; position: relative; z-index: 1; }
/* A flex box, not a block: "Repay loan" wraps to two lines on a narrow phone
   and stretches all three pills to match, which left the one-word labels
   sitting against the top of their button instead of in the middle. */
.pill {
    flex: 1; max-width: 160px; padding: 12px 18px;
    display: flex; align-items: center; justify-content: center; text-align: center;
    border-radius: 999px; font-size: 14.5px; font-weight: 800; border: 0;
    font-family: inherit; cursor: pointer; transition: transform .12s ease, filter .12s ease;
}
.pill:active { transform: translateY(1px); }
.pill-accent { background: var(--accent); color: var(--accent-ink); }
.pill-accent:hover { filter: brightness(1.04); }
.pill-ghost { background: rgba(255,255,255,.14); color: #fff; border: 1px solid rgba(255,255,255,.26); }

/* Translucent sub-card inside the hero (shares / owed / next due) */
.phero-card {
    margin-top: 20px; background: rgba(255,255,255,.10); border: 1px solid var(--hero-line);
    border-radius: 18px; padding: 13px 14px; position: relative; z-index: 1;
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
}
.phero-card a, .phero-card > div { color: #fff; text-align: center; }
.phero-card .hl { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; opacity: .7; font-weight: 700; }
.phero-card .hv { font-size: 14px; font-weight: 800; margin-top: 3px; }
.phero-card .hv.warn { color: var(--accent); }

/* Compact hero used on inner pages */
.phero.compact { padding-bottom: 26px; }
.phero-title { margin-top: 18px; font-size: 22px; font-weight: 800; position: relative; z-index: 1; }
.phero-back { display: inline-flex; align-items: center; gap: 5px; margin-top: 14px; font-size: 13px; font-weight: 700; color: rgba(255,255,255,.85); position: relative; z-index: 1; }

.pwrap { padding: 0 18px; margin-top: 18px; }

/* Legacy balance card (kept for inner pages that still use it) */
.balance-card {
    background: linear-gradient(160deg, var(--hero-1), var(--hero-2));
    color: #fff; border-radius: 22px; padding: 22px; box-shadow: var(--shadow);
    position: relative; overflow: hidden; display: block;
}
.balance-card .lbl { font-size: 13px; opacity: .85; }
.balance-card .amt { font-size: 32px; font-weight: 800; margin: 4px 0 2px; }
.balance-card .sub { font-size: 12.5px; opacity: .8; }
.balance-card .acct { margin-top: 16px; display: flex; justify-content: space-between; font-size: 12.5px; opacity: .9; }

/* Mini stat chips (inner pages) */
.chips { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin: 14px 0; }
.chip { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px; box-shadow: var(--shadow); }
a.chip { display: block; color: inherit; transition: transform .14s, border-color .14s; }
a.chip:active, a.chip:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); }
.chip .cl { font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: .04em; }
.chip .cv { font-size: 15px; font-weight: 800; margin-top: 3px; }
.chip .cv.red { color: var(--red); }
.chip .cv.green { color: var(--green); }

/* =========================================================
   Quick actions — circular pastel icon buttons
   ========================================================= */
.pactions {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 16px 8px; box-shadow: var(--shadow); margin-bottom: 16px;
}
.pact { text-align: center; color: inherit; }
.pact .ic {
    width: 50px; height: 50px; margin: 0 auto 8px; border-radius: 50%;
    display: grid; place-items: center; border: 1.5px solid transparent;
    transition: transform .14s ease;
}
.pact:active .ic { transform: scale(.94); }
.pact .ic svg { width: 21px; height: 21px; }
.pact .ic.g { background: var(--green-bg); color: var(--green); border-color: color-mix(in srgb, var(--green) 22%, transparent); }
.pact .ic.b { background: var(--blue-bg); color: var(--blue); border-color: color-mix(in srgb, var(--blue) 22%, transparent); }
.pact .ic.a { background: var(--amber-bg); color: var(--amber); border-color: color-mix(in srgb, var(--amber) 25%, transparent); }
.pact .ic.v { background: var(--violet-bg); color: var(--violet); border-color: color-mix(in srgb, var(--violet) 22%, transparent); }
.pact span { font-size: 11.5px; font-weight: 700; color: var(--muted); display: block; }

/* Section header */
.psec { display: flex; align-items: center; justify-content: space-between; margin: 20px 0 10px; }
.psec h2 { font-size: 15.5px; }
.psec a { font-size: 12.5px; color: var(--brand); font-weight: 700; }

/* Cards / lists */
.pcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.pcard.pad { padding: 16px; }

.trow { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.trow:last-child { border-bottom: none; }
.trow .tic { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; }
.tic.in { background: var(--green-bg); color: var(--green); }
.tic.out { background: var(--red-bg); color: var(--red); }
.tic.loan { background: var(--amber-bg); color: var(--amber); }
.tic svg { width: 18px; height: 18px; }
.trow .tbody { flex: 1; min-width: 0; }
.trow .tbody b { display: block; font-size: 14px; }
.trow .tbody span { font-size: 12px; color: var(--faint); }
.trow .tamt { font-weight: 800; font-size: 14px; }
.tamt.in { color: var(--green); }
.tamt.out { color: var(--red); }

/* Loan card */
.loan-card { padding: 16px; border-bottom: 1px solid var(--line); }
.loan-card:last-child { border-bottom: none; }
.loan-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.loan-top .lt-title { font-size: 14px; font-weight: 800; }
.loan-top .lt-sub { font-size: 12px; color: var(--faint); }
.progress { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; margin: 8px 0; }
.progress > span { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
.loan-meta { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); }
.loan-meta b { color: var(--ink); }

.pbadge { font-size: 11px; font-weight: 800; padding: 3px 9px; border-radius: 999px; }
.pbadge.active { background: var(--green-bg); color: var(--green); }
.pbadge.pending { background: var(--amber-bg); color: var(--amber); }
.pbadge.completed { background: color-mix(in srgb, var(--brand) 12%, white); color: var(--brand); }
.pbadge.rejected, .pbadge.arrears { background: var(--red-bg); color: var(--red); }

.pempty { text-align: center; padding: 30px 18px; color: var(--faint); font-size: 13.5px; }

/* Detail list (profile) */
.pdl > div { display: flex; justify-content: space-between; gap: 14px; padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.pdl > div:last-child { border-bottom: none; }
.pdl dt { color: var(--muted); margin: 0; }
.pdl dd { margin: 0; font-weight: 600; text-align: right; }

/* Forms */
.pfield { margin-bottom: 14px; }
.pfield label { display: block; font-size: 12.5px; font-weight: 700; margin-bottom: 6px; }
.pfield input, .pfield select {
    width: 100%; padding: 13px 14px; border: 1.5px solid var(--line);
    border-radius: 14px; font-family: inherit; font-size: 14.5px; background: #fff;
}
.pfield input:focus, .pfield select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 16%, transparent); }
/* display:block matters: .pbtn is used on <a> as well as <button>, and an
   inline <a> ignores width, so two of them ran together on one line instead
   of stacking as full-width buttons. */
.pbtn {
    display: block; width: 100%; padding: 14px;
    border: 0; border-radius: 999px;
    font-family: inherit; font-weight: 800; font-size: 15px;
    text-align: center; text-decoration: none;
    cursor: pointer;
}
.pbtn:hover { text-decoration: none; }
/* Stacked buttons space themselves rather than each caller adding a margin. */
.pbtn + .pbtn { margin-top: 10px; }
.pbtn-green { background: var(--brand); color: #fff; }
.pbtn-accent { background: var(--accent); color: var(--accent-ink); }
.pbtn-ghost { background: var(--surface); border: 1px solid var(--line); color: var(--ink); }

.p-alert { padding: 12px 14px; border-radius: 14px; font-size: 13.5px; margin-bottom: 14px; }
.p-alert-ok { background: var(--green-bg); color: #14532d; }
.p-alert-err { background: var(--red-bg); color: #7f1d1d; }

/* =========================================================
   Floating tab bar with a centre chat button
   ========================================================= */
.ptabs {
    position: fixed; left: 50%; transform: translateX(-50%); bottom: 16px; z-index: 40;
    width: calc(100% - 28px); max-width: 460px;
    background: linear-gradient(160deg, var(--hero-1), var(--hero-2));
    border-radius: 26px;
    display: flex; align-items: center; justify-content: space-around;
    padding: 9px 8px calc(9px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 12px 32px rgba(15,23,42,.28);
}
.ptab {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    color: rgba(255,255,255,.62); font-size: 10px; font-weight: 700;
    padding: 6px 4px; border-radius: 14px; min-width: 54px;
}
.ptab svg { width: 21px; height: 21px; }
.ptab.active { color: #fff; }
.ptab.active svg { stroke-width: 2.4; }

/* Centre action button — the chat launcher */
.ptab-fab {
    width: 54px; height: 54px; border-radius: 50%; flex-shrink: 0;
    background: var(--accent); color: var(--accent-ink);
    display: grid; place-items: center; position: relative;
    margin-top: -26px; border: 4px solid var(--bg);
    box-shadow: 0 8px 20px color-mix(in srgb, var(--accent) 55%, transparent);
    transition: transform .14s ease;
}
.ptab-fab:active { transform: scale(.94); }
.ptab-fab svg { width: 22px; height: 22px; }
.ptab-fab .fab-badge {
    position: absolute; top: -2px; right: -2px; min-width: 20px; height: 20px; padding: 0 5px;
    border-radius: 999px; background: var(--red); color: #fff; font-size: 11px; font-weight: 800;
    display: grid; place-items: center; border: 2px solid var(--bg);
}
/* display:grid above would otherwise defeat the [hidden] attribute, showing a "0" badge. */
.ptab-fab .fab-badge[hidden] { display: none; }

/* =========================================================
   Support line
   ========================================================= */
.support-row { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.support-btn {
    flex: 1; min-width: 92px; text-align: center; padding: 11px 12px;
    border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
    font-size: 13px; font-weight: 700; color: var(--brand);
}
.support-btn.wa { color: #128c7e; border-color: color-mix(in srgb, #128c7e 30%, var(--line)); }
.support-btn:active { transform: translateY(1px); }

/* =========================================================
   Outstanding balance panel
   ========================================================= */
.outstanding {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 17px; margin: 14px 0;
}
.outstanding .ol { font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--faint); font-weight: 700; }
.outstanding .oamt { font-size: 26px; font-weight: 800; margin: 4px 0 2px; }
.outstanding .oamt.clear { color: var(--green); }
.outstanding-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.outstanding-grid > div { background: var(--bg); border-radius: 14px; padding: 11px 12px; }
.outstanding-grid .gl { font-size: 11px; color: var(--faint); font-weight: 700; text-transform: uppercase; }
.outstanding-grid .gv { font-size: 14px; font-weight: 800; margin-top: 2px; }
.outstanding-grid .gv.red { color: var(--red); }
.outstanding-grid .gv.amber { color: var(--amber); }
.outstanding .obar { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; margin: 12px 0 6px; }
.outstanding .obar > span { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
.outstanding .ofoot { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }

/* =========================================================
   Loan reminder popup
   ========================================================= */
.pmodal {
    position: fixed; inset: 0; z-index: 80; display: flex; align-items: flex-end; justify-content: center;
    background: rgba(15,23,42,.45); padding: 16px;
}
.pmodal[hidden] { display: none; }
.pmodal-card {
    width: 100%; max-width: 460px; background: var(--surface); border-radius: 24px; padding: 22px 20px 18px;
    box-shadow: 0 24px 60px rgba(15,23,42,.28); animation: pmodal-in .22s ease-out;
}
@keyframes pmodal-in { from { transform: translateY(18px); opacity: 0; } to { transform: none; opacity: 1; } }
.pmodal-ic { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 12px; }
.pmodal-ic.due { background: var(--amber-bg); color: var(--amber); }
.pmodal-ic.late { background: var(--red-bg); color: var(--red); }
.pmodal-ic svg { width: 24px; height: 24px; }
.pmodal-card h3 { font-size: 18px; margin-bottom: 6px; }
.pmodal-card p { font-size: 14px; color: var(--muted); margin: 0 0 16px; line-height: 1.55; }
.pmodal-card p b { color: var(--ink); }
.pmodal-actions { display: grid; gap: 8px; }
.pmodal-actions .pbtn { text-align: center; text-decoration: none; display: block; }

/* =========================================================
   Chat
   ========================================================= */
.chat-window {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 14px; height: 50vh; min-height: 240px; overflow-y: auto;
}
.bubble-row { display: flex; margin-bottom: 10px; }
.bubble-row.me { justify-content: flex-end; }
.bubble {
    max-width: 78%; padding: 10px 13px 18px; border-radius: 18px; font-size: 14px;
    line-height: 1.45; position: relative; word-wrap: break-word;
}
.bubble-row.them .bubble { background: var(--bg); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.bubble-row.me .bubble { background: var(--brand); color: #fff; border-bottom-right-radius: 6px; }
.bubble .btime { position: absolute; right: 11px; bottom: 5px; font-size: 10px; opacity: .65; }
.chat-composer { display: flex; gap: 8px; align-items: flex-end; margin-top: 10px; }
.chat-composer textarea {
    flex: 1; resize: none; padding: 12px 15px; border: 1.5px solid var(--line); border-radius: 22px;
    font-family: inherit; font-size: 14.5px; background: #fff; max-height: 110px;
}
.chat-composer textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 16%, transparent); }
.chat-composer button {
    width: 46px; height: 46px; flex-shrink: 0; border: 0; border-radius: 50%;
    background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; cursor: pointer;
}
.chat-composer button svg { width: 19px; height: 19px; }

/* =========================================================
   Portal auth (login)
   ========================================================= */
.portal-auth { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px;
    background: radial-gradient(700px 400px at 50% -10%, color-mix(in srgb, var(--brand) 22%, transparent), transparent 60%), var(--bg); }
.pauth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: 32px 26px; box-shadow: 0 20px 50px rgba(15,23,42,.10); }
.pauth-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; margin-bottom: 22px; }
.pauth-brand .logo { width: 34px; height: 34px; border-radius: 10px; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 900; }
.pauth-card h1 { font-size: 23px; margin-bottom: 5px; }
.pauth-sub { color: var(--muted); font-size: 14px; margin: 0 0 22px; }
.pauth-alt { font-size: 12.5px; color: var(--muted); margin: 18px 0 6px; text-align: center; }
.pauth-back { display: block; text-align: center; font-size: 13px; font-weight: 700; color: var(--brand); }

/* =========================================================
   PIN screen (unlock / first-time setup)
   ========================================================= */
.pin-screen {
    min-height: 100vh; display: flex; flex-direction: column;
    align-items: center; justify-content: center; padding: 24px 18px;
    background: linear-gradient(160deg, var(--brand-deep), color-mix(in srgb, var(--brand) 62%, black));
}
.pin-brand {
    display: flex; align-items: center; gap: 9px; margin-bottom: 18px;
    color: #fff; font-size: 19px; font-weight: 800; letter-spacing: -.01em;
}
.pin-brand img { border-radius: 9px; display: block; }
.pin-card {
    width: 100%; max-width: 400px; background: var(--surface);
    border-radius: 26px; padding: 30px 26px 24px; text-align: center;
    box-shadow: 0 26px 60px rgba(0,0,0,.28);
}
.pin-avatar {
    width: 62px; height: 62px; margin: 0 auto 16px; border-radius: 50%;
    background: var(--brand); color: #fff; display: grid; place-items: center;
    font-size: 24px; font-weight: 800;
}
.pin-card h1 { font-size: 21px; margin-bottom: 8px; }
.pin-sub { font-size: 13.5px; color: var(--muted); line-height: 1.55; margin: 0 0 20px; }
.pin-card .pfield { text-align: left; }
.pin-input {
    width: 100%; padding: 15px 14px; border: 1.5px solid var(--line); border-radius: 14px;
    font-family: inherit; font-size: 30px; font-weight: 800; text-align: center;
    letter-spacing: 14px; text-indent: 14px; background: #fff;
}
.pin-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent); }
.pin-forgot { display: block; margin-top: 16px; font-size: 13.5px; font-weight: 700; color: var(--brand); }
.pin-out { display: block; margin-top: 10px; font-size: 13px; font-weight: 700; color: var(--muted); }
.pin-foot { margin-top: 20px; font-size: 12.5px; color: rgba(255,255,255,.75); }

/* PIN confirmation on money forms */
.pin-confirm input {
    letter-spacing: 8px; text-indent: 8px; font-weight: 800; font-size: 18px; text-align: center;
}

/* Powered-by footer inside the member app */
.portal-powered {
    text-align: center; font-size: 12px; color: var(--faint);
    padding: 18px 0 6px;
}
.portal-powered b { color: var(--muted); font-weight: 700; }

@media print { .ptabs, .phero-actions, .pactions, .pmodal, .support-row { display: none !important; } }


/* ---------- Payout / wallet picker (member withdraw request) ---------- */
.pay-picker { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 8px; }
.pay-opt {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    padding: 12px 8px; border: 1.5px solid var(--line); border-radius: 14px;
    cursor: pointer; text-align: center; background: #fff;
    transition: border-color .14s, box-shadow .14s;
    min-width: 0;
}
.pay-opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.pay-opt.on { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(22,163,74,.14); }
.pay-dot {
    width: 34px; height: 34px; border-radius: 11px;
    display: grid; place-items: center; font-weight: 800; font-size: 15px; flex-shrink: 0;
}
.pay-name { font-size: 12px; font-weight: 700; overflow-wrap: anywhere; }


/* =========================================================
   Treasurer Portal
   Shares the member portal shell; these are the pieces the
   treasurer app adds on top.
   ========================================================= */

.tportal .phero { background: linear-gradient(160deg, #7c3aed, #4c1d95); }

/* ---------- Action cards on the portal home ---------- */
.tcards { display: flex; flex-direction: column; gap: 10px; }
.tcard {
    display: flex; align-items: center; gap: 13px;
    background: #fff; border: 1px solid var(--line); border-radius: 16px;
    padding: 13px 15px; color: inherit; text-decoration: none;
    box-shadow: 0 1px 2px rgba(15,23,42,.04);
}
.tcard:active { transform: scale(.995); }
.tcard-ic {
    width: 42px; height: 42px; border-radius: 13px; flex-shrink: 0;
    display: grid; place-items: center;
}
.tcard-ic svg { width: 21px; height: 21px; }
.tcard-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tcard-body strong { font-size: 14.5px; }
.tcard-body span { font-size: 12.5px; color: var(--muted); }
.tcard-chev { color: var(--faint); font-size: 22px; line-height: 1; flex-shrink: 0; }

/* ---------- Compact stat rows ---------- */
.tstats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 12px; }
.tstats > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tstats span {
    font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em;
    color: var(--faint); font-weight: 700;
}
.tstats strong { font-size: 15px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.tstats strong.up { color: #16a34a; }
.tstats strong.down { color: #dc2626; }

.tsection { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em;
            color: var(--muted); margin: 18px 0 9px; display: flex; align-items: center; gap: 8px; }
.tcount {
    background: #fdf3e0; color: #d97706; border-radius: 999px;
    padding: 2px 9px; font-size: 12px; letter-spacing: 0;
}

/* ---------- Request cards ---------- */
.treq { margin-bottom: 10px; }
.treq.short { border-color: #fecaca; }
.treq-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.treq-top strong { display: block; font-size: 15px; }
.treq-top span { display: block; font-size: 12px; color: var(--muted); }
.treq-amt { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.treq-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.treq-meta span {
    font-size: 11.5px; font-weight: 600; color: var(--muted);
    background: #f1f5f9; border-radius: 999px; padding: 4px 10px;
}
.treq-note { margin: 10px 0 0; font-size: 13px; color: var(--muted); font-style: italic; }
.treq-warn {
    margin-top: 10px; background: #fef2f2; color: #b91c1c;
    border-radius: 10px; padding: 9px 12px; font-size: 12.5px; font-weight: 600;
}
.treq-actions { display: flex; gap: 9px; margin-top: 13px; }
.treq-actions form { flex: 1; }
.treq-actions .pbtn { margin: 0; width: 100%; }

.tloan-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
    margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line);
}
.tloan-grid > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tloan-grid span { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: var(--faint); font-weight: 700; }
.tloan-grid strong { font-size: 13px; font-variant-numeric: tabular-nums; }

/* ---------- Auto-approve switch ---------- */
.tswitch { border-left: 4px solid var(--line); }
.tswitch.on { border-left-color: #d97706; background: #fffbeb; }
.tswitch-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.tswitch-row strong { display: block; font-size: 14px; }
.tswitch-row > div > span { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.tswitch-toggle { position: relative; display: inline-block; width: 50px; height: 29px; flex-shrink: 0; }
.tswitch-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.tswitch-slider {
    position: absolute; inset: 0; border-radius: 999px;
    background: #e2e8f0; transition: background .18s; cursor: pointer;
}
.tswitch-slider::after {
    content: ""; position: absolute; top: 3px; left: 3px;
    width: 23px; height: 23px; border-radius: 50%; background: #fff;
    box-shadow: 0 1px 4px rgba(15,23,42,.3); transition: transform .18s;
}
.tswitch-toggle input:checked + .tswitch-slider { background: #d97706; }
.tswitch-toggle input:checked + .tswitch-slider::after { transform: translateX(21px); }

/* ---------- Mini rows, feeds, buckets ---------- */
.tmini {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 10px 0; border-bottom: 1px solid var(--line);
}
.tmini:last-of-type { border-bottom: none; }
.tmini strong { display: block; font-size: 13.5px; }
.tmini span { display: block; font-size: 11.5px; color: var(--muted); }
.tmini-amt { font-size: 13.5px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tmini-amt.up { color: #16a34a; }

.tfeed { display: flex; flex-direction: column; }
.tfeed-row { display: flex; align-items: center; gap: 11px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.tfeed-row:last-child { border-bottom: none; }
.tfeed-dot {
    width: 30px; height: 30px; border-radius: 10px; flex-shrink: 0;
    display: grid; place-items: center; font-weight: 800; font-size: 14px;
}
.tfeed-dot.in  { background: #e9f9ef; color: #16a34a; }
.tfeed-dot.out { background: #fdecec; color: #dc2626; }
.tfeed-body { flex: 1; min-width: 0; }
.tfeed-body strong { display: block; font-size: 13.5px; }
.tfeed-body span { display: block; font-size: 11.5px; color: var(--muted); }
.tfeed-amt { text-align: right; font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tfeed-amt.in { color: #16a34a; }
.tfeed-amt.out { color: #dc2626; }
.tfeed-amt span { display: block; font-size: 10.5px; font-weight: 600; color: var(--faint); }

.tseg {
    display: flex; gap: 4px; background: #eef2f7; border-radius: 14px;
    padding: 4px; margin: 14px 0;
}
.tseg a {
    flex: 1; text-align: center; padding: 9px 6px; border-radius: 11px;
    font-size: 13px; font-weight: 700; color: var(--muted); text-decoration: none;
}
.tseg a.on { background: #fff; color: var(--brand); box-shadow: 0 1px 3px rgba(15,23,42,.1); }

.tbuckets { display: flex; flex-direction: column; gap: 13px; }
.tbucket-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.tbucket-top strong { font-size: 13.5px; }
.tbucket-top span { font-size: 13.5px; font-weight: 800; font-variant-numeric: tabular-nums; }
.tbucket-bar { display: block; height: 7px; border-radius: 999px; background: #eef2f7; overflow: hidden; margin: 6px 0 4px; }
.tbucket-bar > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #7c3aed, #4c1d95); }
.tbucket-sub { font-size: 11.5px; color: var(--muted); }

/* ---------- Chat ---------- */
.tchat { max-height: 58vh; overflow-y: auto; display: flex; flex-direction: column; gap: 9px; padding-bottom: 6px; }
.tmsg { max-width: 82%; border-radius: 16px; padding: 9px 13px; font-size: 14px; line-height: 1.5; }
.tmsg.in  { align-self: flex-start; background: #f1f5f9; border-bottom-left-radius: 5px; }
.tmsg.out { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 5px; }
.tmsg-time { font-size: 10.5px; opacity: .7; margin-top: 3px; }
.tchat-composer { display: flex; gap: 8px; align-items: flex-end; margin-top: 12px; }

.tthread {
    display: flex; align-items: center; gap: 12px; padding: 11px 0;
    border-bottom: 1px solid var(--line); color: inherit; text-decoration: none;
}
.tthread:last-of-type { border-bottom: none; }
.tthread-av {
    width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
    display: grid; place-items: center; font-weight: 800; font-size: 14px;
    background: #ede9fe; color: #7c3aed;
}
.tthread-body { flex: 1; min-width: 0; }
.tthread-body strong { display: block; font-size: 14px; }
.tthread-body span { display: block; font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tthread-side { text-align: right; flex-shrink: 0; }
.tthread-time { display: block; font-size: 11px; color: var(--faint); }
.tthread-badge {
    display: inline-block; margin-top: 4px; background: #dc2626; color: #fff;
    border-radius: 999px; padding: 1px 7px; font-size: 11px; font-weight: 800;
}

/* ---------- Profile ---------- */
.tprofile { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.tprofile-av {
    width: 56px; height: 56px; border-radius: 18px; flex-shrink: 0;
    display: grid; place-items: center; font-size: 22px; font-weight: 800;
    background: #ede9fe; color: #7c3aed;
}
.tprofile strong { display: block; font-size: 17px; }
.tprofile span { display: block; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.tprofile-tag { font-size: 12px !important; color: var(--brand) !important; font-weight: 700; margin-top: 2px; }

.tdetails { display: flex; flex-direction: column; }
.tdetails > div {
    display: flex; justify-content: space-between; gap: 12px;
    padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13.5px;
}
.tdetails > div:last-child { border-bottom: none; }
.tdetails span { color: var(--muted); font-weight: 600; flex-shrink: 0; }
.tdetails strong { text-align: right; overflow-wrap: anywhere; }

/* ---------- PIN confirmation sheet ---------- */
.tpin-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.55); z-index: 90; }
.tpin-sheet {
    position: fixed; z-index: 95; left: 0; right: 0; bottom: 0;
    background: #fff; border-radius: 22px 22px 0 0;
    padding: 22px 20px calc(20px + env(safe-area-inset-bottom));
    box-shadow: 0 -14px 44px rgba(15,23,42,.3);
}
.tpin-sheet h3 { font-size: 17px; margin: 0 0 5px; }
.tpin-sheet p { margin: 0 0 14px; font-size: 13.5px; color: var(--muted); }
.tpin-actions { display: flex; gap: 9px; margin-top: 14px; }
.tpin-actions .pbtn { margin: 0; flex: 1; }

@media (min-width: 620px) {
    .tpin-sheet {
        left: 50%; right: auto; bottom: auto; top: 50%;
        transform: translate(-50%, -50%);
        width: 420px; border-radius: 18px;
    }
}

/* ---------- My records (treasurer's own account) ---------- */
.tmybal { text-align: center; }
.tmybal-lbl { display: block; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); font-weight: 700; }
.tmybal-amt { display: block; font-size: 30px; font-weight: 800; margin: 5px 0 3px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.tmybal-sub { display: block; font-size: 12.5px; color: var(--muted); }

.tstats-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.tstat-card {
    background: #fff; border: 1px solid var(--line); border-radius: 14px;
    padding: 12px 13px; display: flex; flex-direction: column; gap: 2px; min-width: 0;
}
.tstat-card span { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); font-weight: 700; }
.tstat-card strong { font-size: 15.5px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.tstat-card strong.up { color: #16a34a; }
.tstat-card strong.down { color: #dc2626; }
.tstat-card em { font-size: 11px; color: var(--muted); font-style: normal; }

.tsuggest { display: flex; flex-direction: column; gap: 8px; }
.tsuggest-opt {
    display: flex; align-items: center; gap: 11px;
    border: 1.5px solid var(--line); border-radius: 14px; padding: 11px 13px; cursor: pointer;
}
.tsuggest-opt:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(124,58,237,.14); }
.tsuggest-opt input { margin: 0; flex-shrink: 0; }
.tsuggest-av {
    width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
    display: grid; place-items: center; font-weight: 800; font-size: 13px;
    background: #ede9fe; color: #7c3aed;
}
.tsuggest-body { min-width: 0; }
.tsuggest-body strong { display: block; font-size: 14px; }
.tsuggest-body span { display: block; font-size: 12px; color: var(--muted); }

.tloan { padding: 11px 0; border-bottom: 1px solid var(--line); }
.tloan:last-child { border-bottom: none; }
.tloan-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 7px; }
.tloan-top strong { display: block; font-size: 15px; font-variant-numeric: tabular-nums; }
.tloan-top span { display: block; font-size: 12px; color: var(--muted); }

/* Sign-out and other destructive actions in the portal. */
.pbtn-danger { background: var(--surface); border: 1px solid #fecaca; color: #dc2626; }
.pbtn-danger:hover { background: #fef2f2; }

/* ---------- "Which SACCO?" — only when one phone opens several accounts ---------- */
.sacco-choice { display: flex; flex-direction: column; gap: 10px; }
.sacco-choice-btn {
    display: block; width: 100%; text-align: left; cursor: pointer;
    padding: 14px 16px; border-radius: 14px;
    border: 1.5px solid var(--line); background: #fff;
    font-family: inherit; color: inherit;
    transition: border-color .14s, box-shadow .14s;
}
.sacco-choice-btn:hover { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(22,163,74,.12); }
.sacco-choice-name { display: block; font-size: 15px; font-weight: 800; }
.sacco-choice-sub  { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* =========================================================================
   The member door (/app) and the "add to your phone" prompt
   ========================================================================= */

/* Small helper text under a field on the door. */
.app-door .pfield .hint { font-size: 12px; color: var(--muted); margin-top: 5px; }

/* Call / email support, side by side under the form. */
.door-help { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.door-help-btn {
    display: flex; align-items: center; justify-content: center; gap: 7px;
    padding: 11px 12px; border-radius: 12px; text-decoration: none;
    border: 1.5px solid var(--line); background: #fff;
    font-size: 13.5px; font-weight: 700; color: var(--ink);
    transition: border-color .14s, background .14s;
}
.door-help-btn:hover { border-color: var(--brand); background: #f0fdf4; }
.door-help-btn svg { width: 16px; height: 16px; flex: none; color: var(--brand); }

/* ---------- Install prompt ---------- */
.pwa-install {
    position: fixed; left: 12px; right: 12px; z-index: 60;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    display: flex; align-items: center; gap: 12px;
    padding: 12px 12px 12px 14px; border-radius: 16px;
    background: #fff; border: 1px solid var(--line);
    box-shadow: 0 10px 30px rgba(2, 24, 12, .16);
    animation: pwaRise .28s ease-out both;
}
/* Inside the app the tab bar owns the bottom of the screen — sit above it.
   Clear of the bar itself AND of the round chat button, which is pulled 26px
   up out of the bar and would otherwise be half-covered. */
.portal-shell ~ .pwa-install,
body:not(.portal-auth) .pwa-install { bottom: calc(100px + env(safe-area-inset-bottom, 0px)); }

.pwa-install[hidden] { display: none; }
@keyframes pwaRise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.pwa-install-body { display: flex; align-items: center; gap: 11px; min-width: 0; flex: 1; }
.pwa-install-icon { width: 38px; height: 38px; border-radius: 9px; flex: none; }
.pwa-install-text { min-width: 0; }
.pwa-install-text b { display: block; font-size: 13.5px; font-weight: 800; color: var(--ink); }
.pwa-install-text small { display: block; font-size: 11.5px; color: var(--muted); margin-top: 1px; }

.pwa-install-actions { display: flex; align-items: center; gap: 4px; flex: none; }
.pwa-install-btn {
    padding: 9px 16px; border: 0; border-radius: 10px; cursor: pointer;
    background: var(--brand); color: #fff;
    font-family: inherit; font-size: 13.5px; font-weight: 800;
}
.pwa-install-btn:hover { background: var(--brand-deep); }
.pwa-install-x {
    width: 30px; height: 30px; border: 0; border-radius: 50%; cursor: pointer;
    background: transparent; color: var(--muted);
    font-size: 21px; line-height: 1; padding: 0;
}
.pwa-install-x:hover { background: #f1f5f9; color: var(--ink); }

/* iOS cannot install programmatically, so it gets instructions instead. */
.pwa-ios {
    position: fixed; inset: 0; z-index: 70; display: flex;
    align-items: flex-end; justify-content: center;
    background: rgba(2, 24, 12, .45); padding: 16px;
}
.pwa-ios[hidden] { display: none; }
.pwa-ios-card {
    position: relative; width: 100%; max-width: 420px;
    background: #fff; border-radius: 18px; padding: 22px 20px 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, .3);
    animation: pwaRise .24s ease-out both;
}
.pwa-ios-card h3 { margin: 0 0 12px; font-size: 17px; font-weight: 800; }
.pwa-ios-card ol { margin: 0; padding-left: 20px; font-size: 14px; line-height: 1.9; color: var(--ink); }
.pwa-ios-card p { margin: 14px 0 0; font-size: 12.5px; color: var(--muted); }
.pwa-ios-close {
    position: absolute; top: 12px; right: 12px;
    width: 30px; height: 30px; border: 0; border-radius: 50%; cursor: pointer;
    background: #f1f5f9; color: var(--muted); font-size: 20px; line-height: 1; padding: 0;
}

/* Room for the floating install prompt, added only while it is showing. */
body.has-pwa-prompt { padding-bottom: 92px; }

/* ---------- "Get the app": the permanent install button ---------- */
.get-app {
    display: flex; align-items: center; gap: 12px; width: 100%; cursor: pointer;
    margin-top: 16px; padding: 13px 16px; border-radius: 14px;
    border: 1.5px solid var(--brand); background: #f0fdf4;
    font-family: inherit; text-align: left; color: var(--ink);
    transition: background .14s, box-shadow .14s;
}
.get-app[hidden] { display: none; }
.get-app:hover { background: #dcfce7; box-shadow: 0 0 0 3px rgba(22,163,74,.12); }
.get-app svg { width: 22px; height: 22px; flex: none; color: var(--brand); }
.get-app b { display: block; font-size: 14.5px; font-weight: 800; }
.get-app small { display: block; font-size: 11.5px; color: var(--muted); margin-top: 1px; }

/* Once the app IS installed there is nothing to get. */
body.is-installed .get-app { display: none; }

/* ---------- The PIN reassurance on the door ---------- */
.pin-note {
    display: flex; gap: 10px; margin-top: 14px;
    padding: 12px 14px; border-radius: 12px;
    background: var(--surface-2, #f8fafc); border: 1px solid var(--line);
    font-size: 12px; line-height: 1.6; color: var(--muted);
}
.pin-note svg { width: 17px; height: 17px; flex: none; color: var(--brand); margin-top: 1px; }
.pin-note b { color: var(--ink); }

/* =========================================================================
   Hide-the-money toggle
   ========================================================================= */
.phero-tools { display: flex; align-items: center; gap: 9px; flex-shrink: 0; }

.phero-eye {
    width: 42px; height: 42px; border-radius: 14px; flex-shrink: 0; padding: 0;
    background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.2);
    display: grid; place-items: center; color: #fff; cursor: pointer;
    font-family: inherit; transition: background .14s;
}
.phero-eye:hover { background: rgba(255,255,255,.22); }
.phero-eye svg { width: 19px; height: 19px; }

/* One icon at a time: open eye while figures show, struck-through once hidden. */
.phero-eye .eye-shut { display: none; }
body.money-hidden .phero-eye .eye-open { display: none; }
body.money-hidden .phero-eye .eye-shut { display: block; }

/* Amounts keep their own width steady so the layout does not jump when
   they are masked, and stars sit at the same optical weight as digits. */
.amt-mask { font-variant-numeric: tabular-nums; }
body.money-hidden .amt-mask { letter-spacing: .06em; }

/* =========================================================================
   App colour picker (Profile tab)
   ========================================================================= */
.theme-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }

.theme-swatch { display: block; text-align: center; cursor: pointer; }
.theme-swatch input { position: absolute; opacity: 0; pointer-events: none; }

.theme-swatch .sw {
    display: grid; place-items: center;
    width: 100%; height: 58px; border-radius: 14px;
    border: 2px solid transparent; box-shadow: inset 0 0 0 1px rgba(0,0,0,.06);
    transition: transform .12s ease, box-shadow .12s ease;
}
.theme-swatch:hover .sw { transform: translateY(-2px); }
.theme-swatch .tick { color: #fff; font-size: 19px; font-weight: 800; opacity: 0; transition: opacity .12s; }
.theme-swatch.on .tick { opacity: 1; }
.theme-swatch.on .sw { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--ink); }

.theme-swatch .nm { display: block; font-size: 11.5px; font-weight: 700; color: var(--muted); margin-top: 6px; }
.theme-swatch.on .nm { color: var(--ink); }

/* The "My SACCO" option reads as the absence of a choice, not a ninth colour. */
.theme-default .sw { position: relative; }
.theme-default .sw::after {
    content: ""; position: absolute; inset: 0; border-radius: 11px;
    border: 2px dashed rgba(255,255,255,.55);
}

/* Keyboard focus has to be visible since the real radio is hidden. */
.theme-swatch input:focus-visible + .sw { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--brand); }

/* =========================================================================
   The hide-amounts eye, sitting on the balance itself.

   It used to live up beside the notification bell, ~300px from the figure it
   covers, and members did not find it. On the balance it is unmissable and
   the gesture is obvious: tap the eye on the number to hide the number.
   ========================================================================= */
.amt-row {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    margin: 5px 0 3px;
}
.amt-row .amt { margin: 0; }

.bal-eye {
    width: 34px; height: 34px; flex: none; padding: 0; cursor: pointer;
    border-radius: 50%; display: grid; place-items: center;
    background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.3);
    color: #fff; font-family: inherit;
    transition: background .14s, transform .12s;
}
.bal-eye:hover { background: rgba(255,255,255,.3); }
.bal-eye:active { transform: scale(.92); }
.bal-eye svg { width: 17px; height: 17px; }
.bal-eye .eye-shut { display: none; }
body.money-hidden .bal-eye .eye-open { display: none; }
body.money-hidden .bal-eye .eye-shut { display: block; }
/* Hidden state is a state, so say so rather than leaving it ambiguous. */
body.money-hidden .bal-eye { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* Says which part of the balance is borrowed rather than saved. */
.phero-bal .bal-note {
    margin-top: 4px; font-size: 11.5px; opacity: .85;
    color: var(--accent);
}

/* =========================================================================
   Sign-in: forgot PIN, and the reset steps
   ========================================================================= */
.forgot-pin { font-weight: 700; color: var(--brand); }
.forgot-pin:hover { text-decoration: underline; }

.steps-card {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: 16px; padding: 6px 4px; margin-top: 4px;
}
.step-row {
    display: flex; gap: 12px; align-items: flex-start;
    padding: 12px 14px; font-size: 13.5px; line-height: 1.6; color: var(--muted);
}
.step-row + .step-row { border-top: 1px solid var(--line); }
.step-row b { color: var(--ink); }
.step-n {
    flex: none; width: 24px; height: 24px; border-radius: 50%;
    background: var(--brand); color: #fff;
    display: grid; place-items: center; font-size: 12px; font-weight: 800;
}

/* =========================================================================
   Withdraw: where the money goes
   ========================================================================= */
.dest-picker { display: flex; flex-direction: column; gap: 10px; }
.dest-picker .dest-opt {
    /* Beats `.pfield label { display:block }`, which otherwise stacks the
       tick under the text instead of putting it on the right. */
    display: flex; align-items: center; gap: 12px; cursor: pointer;
    padding: 14px 16px; border-radius: 14px;
    border: 1.5px solid var(--line); background: var(--surface);
    transition: border-color .14s, background .14s;
}
.dest-picker .dest-opt input { position: absolute; opacity: 0; pointer-events: none; }
.dest-picker .dest-opt .dest-body { flex: 1; min-width: 0; }
.dest-picker .dest-opt b { display: block; font-size: 14.5px; font-weight: 800; }
.dest-picker .dest-opt small { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.dest-picker .dest-opt .dest-tick {
    flex: none; width: 24px; height: 24px; border-radius: 50%;
    border: 1.5px solid var(--line); color: transparent;
    display: grid; place-items: center; font-size: 13px; font-weight: 800;
}
.dest-picker .dest-opt.on { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 6%, #fff); }
.dest-picker .dest-opt.on .dest-tick { background: var(--brand); border-color: var(--brand); color: #fff; }

/* =========================================================================
   Profile: a settings hub of rows that lead somewhere
   ========================================================================= */
.set-group { margin: 18px 0 0; }
.set-group > h2 {
    font-size: 12px; text-transform: uppercase; letter-spacing: .06em;
    color: var(--faint); font-weight: 800; margin: 0 4px 8px;
}
.set-card {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: 18px; overflow: hidden; box-shadow: var(--shadow);
}
.set-row {
    display: flex; align-items: center; gap: 13px;
    padding: 15px 16px; color: inherit; background: none; border: 0; width: 100%;
    font-family: inherit; text-align: left; cursor: pointer;
}
.set-row + .set-row { border-top: 1px solid var(--line); }
.set-row:hover { background: #fafbfd; }
.set-ic {
    flex: none; width: 38px; height: 38px; border-radius: 12px;
    display: grid; place-items: center;
}
.set-ic svg { width: 18px; height: 18px; }
.set-body { flex: 1; min-width: 0; }
.set-body b { display: block; font-size: 14.5px; font-weight: 700; }
.set-body small { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.set-val { font-size: 12.5px; color: var(--muted); font-weight: 700; flex: none; }
.set-go { flex: none; width: 18px; height: 18px; color: var(--faint); }
.set-row.danger .set-body b { color: var(--red); }

/* =========================================================================
   Theme picker — proper cards, not tiny swatches
   ========================================================================= */
.theme-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.theme-card { display: block; cursor: pointer; }
.theme-card input { position: absolute; opacity: 0; pointer-events: none; }
.theme-prev {
    /* These are <span>s inside a <label>; without display:block the heights
       below are ignored and every preview collapses to a sliver. */
    display: block; position: relative; height: 96px;
    border-radius: 16px; overflow: hidden;
    border: 2px solid transparent; box-shadow: var(--shadow);
    transition: transform .14s ease, box-shadow .14s ease;
}
.theme-prev .tp-hero, .theme-prev .tp-body { display: block; width: 100%; }
.theme-card:hover .theme-prev { transform: translateY(-2px); }
/* A miniature of the app: hero band, balance line, two pills. */
.theme-prev .tp-hero { height: 54%; background: linear-gradient(160deg, var(--tp), color-mix(in srgb, var(--tp) 62%, black)); }
.theme-prev .tp-bar { position: absolute; top: 16px; left: 12px; height: 7px; width: 46%; border-radius: 4px; background: rgba(255,255,255,.85); }
.theme-prev .tp-bar2 { position: absolute; top: 29px; left: 12px; height: 5px; width: 28%; border-radius: 4px; background: rgba(255,255,255,.5); }
.theme-prev .tp-body { height: 46%; background: var(--bg); position: relative; }
.theme-prev .tp-pill { position: absolute; top: 10px; height: 12px; border-radius: 999px; }
.theme-prev .tp-pill.a { left: 12px; width: 34%; background: var(--tp); }
.theme-prev .tp-pill.b { left: calc(34% + 20px); width: 26%; background: var(--line); }
.theme-card.on .theme-prev { border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tp) 30%, transparent); }
.theme-name {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 8px; font-size: 13px; font-weight: 700; color: var(--muted);
}
.theme-card.on .theme-name { color: var(--ink); }
.theme-name .tn-tick { opacity: 0; color: var(--brand); font-weight: 800; }
.theme-card.on .theme-name .tn-tick { opacity: 1; }

/* The "Powered by PledgePay" credit. A real link, but it must not shout over
   the page it sits under, so it inherits colour and only underlines on hover. */
.powered-link { color: inherit; text-decoration: none; border-bottom: 1px solid currentColor; opacity: .85; }
.powered-link:hover,
.powered-link:focus-visible { opacity: 1; text-decoration: none; }

/* =========================================================
   My photo
   ========================================================= */
.photo-now {
    width: 132px; height: 132px; margin: 0 auto 16px; border-radius: 50%;
    overflow: hidden; background: var(--brand); color: #fff;
    display: grid; place-items: center;
    box-shadow: 0 8px 22px rgba(0,0,0,.16);
}
.photo-now img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-initials { font-size: 44px; font-weight: 800; letter-spacing: .02em; }

/* A styled label standing in for the file input, because the browser's own
   control cannot be styled and reads as "No file chosen" on a phone. */
.photo-pick {
    display: flex; align-items: center; justify-content: center; gap: 9px;
    padding: 13px 16px; margin-bottom: 8px; cursor: pointer;
    border: 1.5px dashed var(--line); border-radius: 14px;
    font-size: 14px; font-weight: 700; color: var(--brand);
    background: var(--surface);
}
.photo-pick:hover { border-color: var(--brand); }
.photo-pick svg { width: 20px; height: 20px; flex: none; }

.pcard .hint { font-size: 12.5px; color: var(--muted); margin-top: 5px; }
.pbtn:disabled { opacity: .5; cursor: not-allowed; }

/* The profile avatar. `.pav` carried only inline sizing before and was never
   given a rule, so the initials rendered as loose text rather than a circle. */
.pav {
    border-radius: 50%; background: var(--brand); color: #fff;
    display: grid; place-items: center; font-weight: 800;
}
.pav-link { display: block; text-decoration: none; }
.pav-photo {
    width: 64px; height: 64px; margin: 0 auto 10px; border-radius: 50%;
    object-fit: cover; display: block;
}

/* ---------- About e.sacco (inside the member app) ---------- */
.about-mark { border-radius: 16px; display: block; margin: 0 auto; }
.about-foot {
    text-align: center; color: var(--muted); font-size: 12.5px;
    margin: 4px 0 18px; line-height: 1.6;
}

/* ---------- How am I paying? (member repayment) ---------- */
.pay-how { display: grid; gap: 9px; }
.pay-how-opt {
    display: flex; align-items: flex-start; gap: 11px;
    padding: 12px 13px; border: 1.5px solid var(--line); border-radius: 14px;
    cursor: pointer; background: var(--surface);
}
.pay-how-opt input { margin-top: 3px; width: auto; flex: none; accent-color: var(--brand); }
.pay-how-opt.on { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 7%, var(--surface)); }
.pay-how-opt.off { opacity: .55; cursor: not-allowed; }
.pay-how-body { display: block; }
.pay-how-body b { display: block; font-size: 14px; }
.pay-how-body small { display: block; color: var(--muted); font-size: 12.2px; margin-top: 2px; line-height: 1.5; }

/* ---------- "Complete your KYC" ----------
   A banner a member sees on every page until their file is done. Amber rather
   than red: it is a job to finish, not an error they have made. */
.kyc-nudge {
    display: flex; align-items: center; gap: 12px;
    background: #fdf3e0; border: 1px solid #f5d9a8; border-left: 4px solid #d97706;
    border-radius: 12px; padding: 12px 14px; margin-bottom: 14px;
    text-decoration: none; color: #7c4a03;
}
.kyc-nudge:hover { background: #fceed6; text-decoration: none; }
.kyc-nudge-icon {
    flex: none; width: 26px; height: 26px; border-radius: 50%;
    background: #d97706; color: #fff; font-weight: 800; font-size: 15px;
    display: flex; align-items: center; justify-content: center;
}
.kyc-nudge-body { flex: 1 1 auto; min-width: 0; }
.kyc-nudge-body b { display: block; font-size: 14px; }
.kyc-nudge-body small { display: block; font-size: 12.2px; opacity: .9; margin-top: 2px; }
.kyc-nudge-go { flex: none; font-weight: 800; font-size: 13px; white-space: nowrap; }
@media (max-width: 420px) { .kyc-nudge-go { display: none; } }


/* ---------- The role console card ----------
   Deliberately not green. Everything else on this screen is the member's own
   money; this is the other job they do, and it should not read as one more
   savings tile. */
.console-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    margin-bottom: 14px;
    border-radius: 16px;
    text-decoration: none;
    color: #0f172a;
    background: linear-gradient(135deg, #eef2ff, #e0e7ff);
    border: 1px solid #c7d2fe;
    box-shadow: 0 6px 18px rgba(49, 46, 129, 0.08);
}
.console-ic {
    flex: 0 0 auto;
    width: 40px; height: 40px;
    display: grid; place-items: center;
    border-radius: 12px;
    background: #4f46e5; color: #fff;
}
.console-ic svg { width: 21px; height: 21px; }
.console-txt { flex: 1 1 auto; min-width: 0; }
.console-txt b { display: block; font-size: 15px; }
.console-txt small { display: block; font-size: 12.5px; color: #4338ca; margin-top: 1px; }
.console-go { font-size: 24px; color: #4f46e5; line-height: 1; }

[data-theme="dark"] .console-card {
    background: #1e1b4b;
    border-color: #3730a3;
    color: #e0e7ff;
}
[data-theme="dark"] .console-txt small { color: #a5b4fc; }


/* ---------- Treasurer: my own money, my own actions ----------
   Deliberately the same shape as .pactions in the member app. The treasurer's
   "My records" page is their member portal, and a member's first two thoughts
   are paying in and taking out — so those are the first two tiles, and they
   look like the ones they already know from the member app on their phone. */
.tacts {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 9px;
    margin: 14px 0 16px;
}
@media (max-width: 480px) {
    .tacts { grid-template-columns: repeat(2, 1fr); }
}
.tact {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    padding: 13px 6px;
    border-radius: 14px;
    background: var(--surface, #fff);
    border: 1px solid var(--line, #e8ecf3);
    text-decoration: none;
    color: inherit;
    font-size: 12.5px;
    font-weight: 600;
    text-align: center;
    transition: transform .08s ease, border-color .12s ease;
}
.tact:active { transform: translateY(1px); }
.tact:hover  { border-color: #16a34a; }
.tact-ic {
    width: 38px; height: 38px;
    display: grid; place-items: center;
    border-radius: 12px;
    background: rgba(22, 163, 74, .10);
    color: #16a34a;
}
.tact-ic svg { width: 19px; height: 19px; }
.tact-ic.up   { background: rgba(22, 163, 74, .12); color: #16a34a; }
.tact-ic.down { background: rgba(217, 119, 6, .12); color: #b45309; }

@media (prefers-reduced-motion: reduce) {
    .tact { transition: none; }
}
