/* LCU app - mobile-first, system fonts, big tap targets (>= 48px), high contrast. */
*, *::before, *::after { box-sizing: border-box; }

:root {
    --fg: #111111;
    --bg: #ffffff;
    --muted: #4a4a4a;
    --line: #8a8a8a;
    --brand: #0b3d91;      /* white text on this = 10.6:1 */
    --brand-dark: #082a66;
    --danger-fg: #7a0000;
    --danger-bg: #fff1f1;
    --tap: 3rem;           /* 48px */
}

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

body {
    margin: 0;
    color: var(--fg);
    background: #f2f4f8;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Devanagari", Arial, sans-serif;
    font-size: 1.125rem;   /* 18px base for legibility */
    line-height: 1.5;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    min-height: 3.5rem;
    padding: 0.5rem 1rem;
    color: #ffffff;
    background: var(--brand);
}
.brand { font-weight: 700; font-size: 1.125rem; overflow-wrap: anywhere; }
.lang {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--tap);
    min-width: var(--tap);
    padding: 0 1rem;
    color: #ffffff;
    border: 2px solid #ffffff;
    border-radius: 0.5rem;
    text-decoration: none;
    font-weight: 600;
}

.wrap { max-width: 32rem; margin: 0 auto; padding: 1rem; }

.card {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 0.75rem;
    padding: 1.25rem;
}
h1 { margin: 0 0 1rem; font-size: 1.5rem; line-height: 1.25; }

label { display: block; margin: 1rem 0 0.25rem; font-weight: 600; }

input[type="text"], input[type="password"] {
    display: block;
    width: 100%;
    min-height: var(--tap);
    padding: 0.5rem 0.75rem;
    font: inherit;
    color: var(--fg);
    background: #ffffff;
    border: 2px solid var(--line);
    border-radius: 0.5rem;
}

.check {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: var(--tap);
    font-weight: 400;
}
.check input { width: 1.5rem; height: 1.5rem; margin: 0; flex: 0 0 auto; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: var(--tap);
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    font: inherit;
    font-weight: 700;
    color: #ffffff;
    background: var(--brand);
    border: 2px solid var(--brand);
    border-radius: 0.5rem;
    text-decoration: none;
    cursor: pointer;
}
.btn:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn.secondary { color: var(--brand); background: #ffffff; }
.btn.secondary:hover { color: #ffffff; background: var(--brand); }
.btn.ghost { color: var(--brand); background: #ffffff; }
.btn[disabled] { opacity: 0.6; cursor: wait; }

a:focus-visible, button:focus-visible, input:focus-visible {
    outline: 3px solid #ffbf00;
    outline-offset: 2px;
}

.alert {
    margin: 0 0 1rem;
    padding: 0.75rem 1rem;
    color: var(--danger-fg);
    background: var(--danger-bg);
    border: 2px solid var(--danger-fg);
    border-radius: 0.5rem;
    font-weight: 600;
}

.muted { color: var(--muted); }

.facts { display: grid; grid-template-columns: auto 1fr; gap: 0.25rem 1rem; margin: 0 0 1rem; }
.facts dt { font-weight: 600; }
.facts dd { margin: 0; overflow-wrap: anywhere; }

@media (min-width: 40rem) {
    .btn { width: auto; min-width: 12rem; }
    .wrap { padding: 2rem 1rem; }
}

/* ---------- Customers / network screens (read-only step) ---------- */
.wrap.wide { max-width: 72rem; }
.sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
h2 { margin: 0 0 0.75rem; font-size: 1.25rem; }
h2.inline { display: inline; }
.note { margin: 0.75rem 0 0; }

.tabs {
    display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.5rem;
    padding: 0.25rem 1rem; background: #ffffff; border-bottom: 1px solid var(--line);
}
.tabs a, .link-btn {
    display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 0.75rem;
    color: var(--brand); font: inherit; font-weight: 600; text-decoration: none;
    background: none; border: 0; border-bottom: 3px solid transparent; cursor: pointer;
}
.tabs a[aria-current="page"] { border-bottom-color: var(--brand); }
.inline-form { margin: 0 0 0 auto; }

/* search form */
.cf input[type="search"] {
    display: block; width: 100%; min-height: var(--tap); padding: 0.5rem 0.75rem; font: inherit;
    color: var(--fg); background: #ffffff; border: 2px solid var(--line); border-radius: 0.5rem;
}
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.75rem 0 0; padding: 0; }
.chip { display: inline-flex; margin: 0; font-weight: 400; }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip span, .chip.link {
    display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 1rem;
    color: var(--fg); background: #ffffff; border: 2px solid var(--line); border-radius: 2rem; cursor: pointer; text-decoration: none;
}
.chip input:checked + span { color: #ffffff; background: var(--brand); border-color: var(--brand); font-weight: 700; }
.chip input:focus-visible + span, .chip.link:focus-visible { outline: 3px solid #ffbf00; outline-offset: 2px; }

/* refund card + mini list */
.card.refund { border-color: #7a4b00; background: #fff8e8; }
.mini { list-style: none; margin: 0; padding: 0; }
.mini li { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; padding: 0.5rem 0; border-top: 1px solid #d8c9a8; }
.mini li:first-child { border-top: 0; }

/* customer list: cards on mobile, table-like rows on wide screens */
.cust-list { list-style: none; margin: 1rem 0; padding: 0; display: grid; gap: 0.75rem; }
.cust {
    display: grid; gap: 0.5rem 1rem; padding: 0.875rem 1rem; color: var(--fg); background: #ffffff;
    border: 1px solid var(--line); border-left-width: 10px; border-radius: 0.75rem;
}
.c-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.75rem; }
.c-name { font-weight: 700; font-size: 1.125rem; overflow-wrap: anywhere; }
.c-user { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 1rem; }
.c-badge { font-size: 0.875rem; padding: 0.125rem 0.5rem; border: 1px solid currentColor; border-radius: 1rem; }
.c-cell { display: flex; justify-content: space-between; gap: 0.5rem; }
.lbl { color: var(--muted); }
.st-6 .lbl, .st-7 .lbl { color: #f0f0f0; }
.val { font-weight: 600; }
.val.neg { color: #b00000; }
.st-6 .val.neg, .st-7 .val.neg { color: #ffd0d0; }

/* status colours = the old panel (Stats/users.php); text colour chosen for contrast */
.cust.st-6 { background: #18850a; border-left-color: #0c4a04; color: #ffffff; }   /* expired free: dark green */
.cust.st-3 { background: #faac58; border-left-color: #a35a00; }                    /* no-payment blocked: orange */
.cust.st-4 { background: #d9edf7; border-left-color: #1f6fa8; }                    /* trial: blue */
.cust.st-5 { background: #dff0d8; border-left-color: #2e7d32; }                    /* free: green */
.cust.st-8 { background: #d9ea28; border-left-color: #7a8500; }                    /* hold: yellow */
.cust.st-7 { background: #6e6e6e; border-left-color: #333333; color: #ffffff; }    /* refund request: grey */
.cust.st-exp { background: #f2dede; border-left-color: #a94442; }                  /* expired / date passed: red */
.cust.is-deleted { opacity: 0.75; }

.c-act { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.qb {
    min-height: var(--tap); padding: 0 1rem; font: inherit; font-weight: 600; color: var(--brand);
    background: #ffffff; border: 2px solid var(--brand); border-radius: 0.5rem;
}
.qb[disabled] { color: #4a4a4a; border-color: #6a6a6a; background: #eeeeee; cursor: not-allowed; }
.cust-list .empty, .cust-list .more { padding: 1rem; text-align: center; }
.cust-list .more .btn { margin-top: 0; }

@media (min-width: 60rem) {
    .wrap { max-width: 72rem; }
    .cust-list { gap: 0; }
    .cust {
        grid-template-columns: minmax(14rem, 2fr) 8rem 6rem 8rem minmax(6rem, 1fr) auto;
        align-items: center; border-radius: 0; border-width: 1px 1px 0 10px;
    }
    .cust:first-child { border-radius: 0.75rem 0.75rem 0 0; }
    .cust:last-child  { border-radius: 0 0 0.75rem 0.75rem; border-bottom-width: 1px; }
    .c-cell { flex-direction: column; justify-content: flex-start; gap: 0; }
    .c-cell .lbl { font-size: 0.8125rem; }
    .cust .c-act { justify-content: flex-end; }
}

/* My network: nested details */
.net-tree { list-style: none; margin: 0; padding-left: 1rem; border-left: 2px solid #c9d3e6; }
.net-tree.root { padding-left: 0; border-left: 0; }
.net-node { margin: 0.5rem 0; }
.net-node summary, .net-node .leaf {
    display: block; padding: 0.625rem 0.75rem; background: #f7f9fd; border: 1px solid #c9d3e6; border-radius: 0.5rem; cursor: pointer;
}
.net-node .leaf { cursor: default; }
.n-name { display: block; font-weight: 700; overflow-wrap: anywhere; }
.n-facts { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; color: var(--muted); font-size: 0.9375rem; }
.n-facts b { color: var(--fg); }
.n-go { margin: 0.25rem 0 0 0.75rem; }
.n-go .btn { width: auto; min-width: 8rem; margin-top: 0.25rem; }
details > summary { min-height: var(--tap); }

/* ---------- write actions (batch W1): bottom sheet, toasts, credit badge ---------- */
.credit-badge { display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 0.75rem; font-weight: 700; color: #0b3d91; }
.btn.danger, .qb.danger { color: #ffffff; background: #a30000; border-color: #a30000; }
.btn.danger:hover { background: #7a0000; border-color: #7a0000; }
.sheet-host:empty { display: none; }
.sheet-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, 0.55); }
.sheet {
    position: fixed; z-index: 41; left: 0; right: 0; bottom: 0; max-height: 85vh; overflow: auto;
    padding: 1.25rem 1rem calc(1.25rem + env(safe-area-inset-bottom)); background: #ffffff;
    border-radius: 1rem 1rem 0 0; box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.35);
}
.sheet .btn { width: 100%; }
.sheet-q { margin: 0 0 0.5rem; font-size: 1.125rem; font-weight: 700; overflow-wrap: anywhere; }
.sheet-q.alertline { color: #7a0000; }
.sheet-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.5rem; margin: 0.5rem 0; }
.sheet-grid .qb { width: 100%; }
@media (min-width: 40rem) {
    .sheet { left: 50%; right: auto; width: 32rem; transform: translateX(-50%); }
}
.toasts { position: fixed; z-index: 60; left: 0; right: 0; top: 0.75rem; display: grid; gap: 0.5rem; justify-items: center; pointer-events: none; padding: 0 0.75rem; }
.toast {
    max-width: 32rem; padding: 0.75rem 1rem; font-weight: 700; color: #ffffff; border-radius: 0.5rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3); animation: toast-life 7s ease forwards;
}
.toast.ok  { background: #1b6e20; }
.toast.err { background: #a30000; }
@keyframes toast-life { 0% { opacity: 0; transform: translateY(-8px); } 6% { opacity: 1; transform: none; } 88% { opacity: 1; } 100% { opacity: 0; visibility: hidden; } }
.htmx-request .qb, .htmx-request .btn { opacity: 0.6; }

/* Actions Log - colours as the old Stats/log.php rows (danger / warning / plain / info / success) */
.page-h { font-size: 1.3rem; margin: 0.5rem 0; }
.muted { color: var(--muted); font-weight: 400; }
.chip.on { color: #ffffff; background: var(--brand); border-color: var(--brand); font-weight: 700; }
.log-filter { display: grid; gap: 0.5rem; margin: 0.75rem 0; }
.log-filter .f { display: block; font-weight: 700; }
.log-filter .in { display: block; width: 100%; min-height: var(--tap); font: inherit; padding: 0.4rem 0.6rem; border: 2px solid var(--line); border-radius: 0.5rem; margin-top: 0.2rem; }
.log-list { list-style: none; margin: 0; padding: 0; }
.log-list .empty, .log-list .more { padding: 1rem; text-align: center; }
.lg { border-left: 0.45rem solid var(--line); border-radius: 0.5rem; padding: 0.55rem 0.7rem; margin-bottom: 0.5rem; background: #ffffff; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.lg-top { display: flex; justify-content: space-between; gap: 0.5rem; font-size: 0.9rem; }
.lg-time { color: var(--muted); }
.lg-delta { font-weight: 700; white-space: nowrap; }
.lg-act { font-weight: 700; margin: 0.15rem 0; overflow-wrap: anywhere; }
.lg-bal { font-size: 0.85rem; color: var(--muted); }
.lg-out  { background: #f2dede; border-left-color: #a94442; }
.lg-free { background: #fcf8e3; border-left-color: #8a6d3b; }
.lg-same { background: #d9edf7; border-left-color: #1f6fa8; }
.lg-in   { background: #dff0d8; border-left-color: #2e7d32; }

/* Create customer (W2) - comfort first: big green button, big validity choices, clear yes/no messages */
.btn.newcust { display: block; width: 100%; min-height: 4rem; font-size: 1.25rem; background: #18850a; border-color: #18850a; color: #ffffff; margin: 0.5rem 0 0.75rem; }
.create-form .f { display: block; font-weight: 700; margin: 0.6rem 0 0.2rem; }
.create-form .in { display: block; width: 100%; min-height: var(--tap); font: inherit; padding: 0.4rem 0.6rem; border: 2px solid var(--line); border-radius: 0.5rem; }
.big-radios { border: 0; margin: 0.4rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.4rem; }
.big-radios legend { padding: 0; }
.big-radios label { display: block; }
.big-radios input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.big-radios span { display: flex; align-items: center; justify-content: center; min-height: var(--tap); border: 2px solid var(--line); border-radius: 0.5rem; font-weight: 700; text-align: center; }
.big-radios input:checked + span { background: var(--brand); border-color: var(--brand); color: #ffffff; }
.big-radios input:focus-visible + span { outline: 3px solid #ffbf00; outline-offset: 2px; }
.hint { font-size: 0.9rem; color: var(--muted); margin: 0.3rem 0; }
.check { display: flex; align-items: center; gap: 0.5rem; min-height: var(--tap); font-weight: 700; }
.check input { width: 1.4rem; height: 1.4rem; }
.avail-host { min-height: 1.4rem; font-weight: 700; font-size: 0.95rem; }
.avail.ok { color: #18850a; }
.avail.bad { color: var(--danger-fg); }
.btn.create { background: #18850a; border-color: #18850a; color: #ffffff; margin-top: 1rem; }
.btn.wa { background: #1e7e34; border-color: #1e7e34; color: #ffffff; text-align: center; text-decoration: none; }
.ok-line { color: #18850a; }

/* iBk create sheet: distributor typeahead + expiry quick-pick (owner ruling: old UI helpers are part of parity) */
.dist-results { list-style: none; margin: 0.3rem 0 0; padding: 0; display: grid; gap: 0.4rem; }
.dist-row { display: block; width: 100%; text-align: left; min-height: var(--tap); padding: 0.5rem 0.7rem; border: 2px solid var(--line); border-radius: 0.5rem; background: #ffffff; font: inherit; font-weight: 600; color: var(--fg); }
.dist-row:hover, .dist-row:focus-visible { background: #f4f7fd; }
.quickpick-row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.4rem 0 0.8rem; }
.quickpick-row .btn.qp { flex: 1; min-width: 4.5rem; width: auto; margin-top: 0; }

/* Password sheet */
.pw-label { margin: 0.5rem 0 0; color: var(--muted); font-weight: 700; }
.pw-big { font-size: 2rem; font-weight: 700; letter-spacing: 0.1rem; text-align: center; padding: 0.6rem; margin: 0.2rem 0 0.4rem; background: #f4f7fd; border-radius: 0.5rem; overflow-wrap: anywhere; user-select: all; }

/* Broadcast confirm preview */
.bcast-preview { white-space: pre-wrap; overflow-wrap: anywhere; padding: 0.6rem; margin: 0.2rem 0 0.4rem; background: #f4f7fd; border-radius: 0.5rem; border: 1px solid var(--line); }

/* Row checkboxes (Paid / Commentary): big, labelled, one tap saves */
.c-ticks { display: flex; gap: 0.5rem; margin-top: 0.5rem; flex-wrap: wrap; }
.tick { display: flex; align-items: center; gap: 0.45rem; min-height: var(--tap); padding: 0 0.7rem; border: 2px solid var(--line); border-radius: 0.5rem; background: #ffffff; color: var(--fg); font-weight: 700; }
.tick input { width: 1.5rem; height: 1.5rem; margin: 0; }
.tick input:checked + span { color: #18850a; }

/* Pending Payments (khaata) */
.khaata-tot { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin: 0.5rem 0 0.8rem; }
.kt { border-radius: 0.6rem; padding: 0.5rem 0.7rem; text-align: center; }
.kt .lbl { display: block; font-size: 0.85rem; color: var(--muted); }
.kt b { font-size: 1.3rem; }
.kt.owed { background: #f2dede; }
.kt.adv { background: #dff0d8; }
.khaata-list { list-style: none; margin: 0; padding: 0; }
.khaata { border-left: 0.45rem solid var(--line); border-radius: 0.5rem; padding: 0.6rem 0.7rem; margin-bottom: 0.5rem; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.khaata.owes { border-left-color: #a94442; }
.khaata.adv { border-left-color: #2e7d32; }
.k-top { display: flex; justify-content: space-between; gap: 0.5rem; align-items: baseline; }
.k-user { font-weight: 700; overflow-wrap: anywhere; }
.k-bal { font-weight: 700; font-size: 1.2rem; white-space: nowrap; }
.khaata.owes .k-bal { color: #a94442; }
.khaata.adv .k-bal { color: #2e7d32; }
.k-meta { font-size: 0.85rem; color: var(--muted); margin: 0.2rem 0 0.5rem; }
.k-act { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.k-act .btn { flex: 1; min-width: 5rem; margin-top: 0; }

/* Transfer Credits chain preview */
.chain-host { min-height: 1.4rem; font-weight: 700; font-size: 0.95rem; margin: 0.2rem 0; }
.chain-ok { color: var(--brand); overflow-wrap: anywhere; }
.chain-note { display: block; font-weight: 400; color: var(--muted); font-size: 0.85rem; margin-top: 0.2rem; }
.chain-note.warn { color: #8a6d3b; font-weight: 700; }

/* super-admin buttons in the More sheet */
.qb.super { border-color: #8a6d3b; color: #8a6d3b; }

/* Bulk hold bar (Users Table top) */
.bulk-hold { margin: 0 0 0.7rem; border: 2px solid var(--line); border-radius: 0.6rem; }
.bulk-hold summary { min-height: var(--tap); display: flex; align-items: center; padding: 0 0.8rem; font-weight: 700; cursor: pointer; }
.bulk-row { display: flex; flex-wrap: wrap; gap: 0.4rem; padding: 0 0.6rem 0.6rem; }
.bulk-row .btn { flex: 1; min-width: 8rem; margin-top: 0; }
.btn.bulk-toggle.on { background: #18850a; border-color: #18850a; color: #fff; }
.btn.bulk-toggle.off { background: var(--danger-fg); border-color: var(--danger-fg); color: #fff; }
.btn.approve-all { margin: 0 0 0.6rem; }

/* Switch page (W5) */
.sw-warn { background: #fff3cd; border: 1px solid #b89500; border-radius: 0.5rem; padding: 0.6rem 0.8rem; margin: 0.5rem 0; font-weight: 700; }
.sw-state { border: 2px solid var(--line); border-radius: 0.6rem; padding: 0.6rem 0.8rem; margin: 0.6rem 0; }
.sw-state.ok { border-color: #2e7d32; background: #dff0d8; }
.sw-state.fail { border-color: #a94442; background: #f2dede; }
.sw-state.run { border-color: #1f6fa8; background: #d9edf7; }
.sw-state.warn { border-color: #b89500; background: #fff3cd; }
.sw-badge { font-weight: 700; font-size: 1.05rem; }
.sw-sent { color: #1f6fa8; font-weight: 700; }
.sw-log { background: #111; color: #eee; border-radius: 0.5rem; padding: 0.6rem; overflow-x: auto; font-size: 0.8rem; max-height: 16rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.sw-actions { display: grid; gap: 0.7rem; margin: 0.8rem 0; }
.sw-form { border: 1px solid #ccd; border-radius: 0.6rem; padding: 0.6rem; }
.sw-form .f { display: block; font-weight: 700; margin-bottom: 0.3rem; }
.sw-form .in { width: 100%; min-height: var(--tap); font: inherit; padding: 0.4rem 0.6rem; border: 2px solid var(--line); border-radius: 0.5rem; margin-bottom: 0.5rem; text-transform: uppercase; }
.sw-form .btn { width: 100%; margin-top: 0; }

/* Stats page */
.st-h { font-size: 1.1rem; margin: 1rem 0 0.4rem; }
.st-sub { font-weight: 700; margin: 0.5rem 0 0.2rem; }
.st-list { list-style: none; margin: 0; padding: 0; }
.st-list li { display: flex; justify-content: space-between; gap: 0.5rem; align-items: baseline; border-bottom: 1px solid #ddd; padding: 0.45rem 0; font-size: 0.95rem; }
.st-k { font-weight: 700; overflow-wrap: anywhere; }
.st-err-sig { font-weight: 400; font-family: monospace; font-size: 0.8rem; }
.st-bad { color: #a94442; font-weight: 700; }
.st-hot { background: #f2dede; border-radius: 0.4rem; }
.card.st-hot b { color: #a94442; }

/* Payment logs statement */
.stmt-list { list-style: none; margin: 0; padding: 0; }
.stmt-list .empty, .stmt-list .more { padding: 1rem; text-align: center; }
.stmt { border-left: 0.5rem solid var(--line); border-radius: 0.5rem; padding: 0.55rem 0.7rem; margin-bottom: 0.5rem; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.stmt.paid { border-left-color: #2e7d32; background: #f2faf2; }
.stmt.charge { border-left-color: #c99700; background: #fffdf2; }
.stmt.voided { opacity: 0.6; text-decoration: line-through; }
.stmt-top { display: flex; justify-content: space-between; gap: 0.5rem; align-items: baseline; }
.stmt-user { font-weight: 700; overflow-wrap: anywhere; }
.stmt-amt { font-weight: 700; font-size: 1.15rem; white-space: nowrap; }
.stmt.paid .stmt-amt { color: #2e7d32; }
.stmt.charge .stmt-amt { color: #a37500; }
.stmt-what { margin: 0.15rem 0; overflow-wrap: anywhere; }
.stmt-meta { display: flex; flex-wrap: wrap; gap: 0.6rem; font-size: 0.85rem; color: var(--muted); }
.stmt-tal { display: inline-flex; align-items: center; gap: 0.4rem; margin-top: 0.4rem; font-size: 0.85rem; font-weight: 700; }
.stmt-tal .tal-state { display: inline-block; min-width: 1rem; color: #2e7d32; }

/* Khaata "due" chip on customer rows (one-tap to the settle sheet) */
.due-chip { display: inline-flex; align-items: center; min-height: 1.9rem; padding: 0 0.6rem; border-radius: 1rem; font-weight: 700; font-size: 0.9rem; border: 2px solid; margin-left: 0.3rem; background: #fff; cursor: pointer; }
.due-chip.owe { color: #a94442; border-color: #a94442; }
.due-chip.adv { color: #2e7d32; border-color: #2e7d32; }
button.due-chip:active { background: #f2dede; }

/* One-tap "payment received?" prompt after a recharge */
.pay-prompt { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; background: #fff8d6; border: 2px solid #b89500; border-radius: 0.6rem; padding: 0.6rem 0.8rem; margin-top: 0.5rem; font-weight: 700; }
.pay-prompt form { display: contents; }
.pay-prompt .btn { width: auto; min-width: 6rem; margin: 0; }
.pay-prompt.done.ok { background: #dff0d8; border-color: #2e7d32; color: #2e7d32; }
.pay-prompt.done.err { background: #f2dede; border-color: #a94442; color: #a94442; }

/* Growth chart */
.growth-svg { width: 100%; height: 150px; background: #fafbfe; border: 1px solid #dde; border-radius: 0.5rem; margin: 0.3rem 0; }
.growth-legend { font-size: 0.85rem; color: var(--muted); }
.growth-legend .lg-hist { color: #0b3d91; font-weight: 700; }
.growth-legend .lg-fc { color: #18850a; font-weight: 700; }
.cr-dot { display: inline-block; width: 0.7rem; height: 0.7rem; border-radius: 50%; margin: 0 0.25rem 0 0.5rem; vertical-align: middle; }
.cr-dot:first-child { margin-left: 0; }

/* Tips (AI suggestions): one big tappable card per tip, colour-coded by level */
.tip-list { list-style: none; margin: 0.5rem 0; padding: 0; }
.tip { border: 2px solid var(--line); border-left-width: 0.5rem; border-radius: 0.6rem; background: #ffffff; margin: 0 0 0.6rem; }
.tip > a { display: flex; align-items: center; min-height: var(--tap); padding: 0.8rem 1rem; color: var(--fg); text-decoration: none; font-weight: 600; }
.tip > a:active { background: #eef1f7; }
.tip-text { display: block; }
.tip-info { border-color: #0b3d91; background: #f4f7fd; }
.tip-warn { border-color: #a94442; background: #fdf4f4; }
.tip-good { border-color: #2e7d32; background: #f3faf4; }
.tip-ai { padding: 0.8rem 1rem; }
.tip-ai p { margin: 0 0 0.5rem; font-weight: 600; }
.tip-ai p.hint { font-weight: 400; margin-bottom: 0; }

/* super-admin read-only lists: Admins Credits, Distributor's List, Refund Logs */
.adm-list, .rfl-list { list-style: none; margin: 0; padding: 0; }
.adm-list .empty, .rfl-list .empty, .rfl-list .more { padding: 1rem; text-align: center; }
.adm { border: 1px solid var(--line); border-left: 0.5rem solid var(--brand); border-radius: 0.5rem;
       padding: 0.6rem 0.75rem; margin-bottom: 0.6rem; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.adm-top { display: flex; justify-content: space-between; gap: 0.5rem; align-items: baseline; flex-wrap: wrap; }
.adm-user { font-weight: 700; font-size: 1.1rem; overflow-wrap: anywhere; }
.adm-cred { white-space: nowrap; }
.adm-name { margin: 0.15rem 0 0.35rem; overflow-wrap: anywhere; }
.adm-meta { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; font-size: 0.9rem; color: var(--muted); }
.adm-meta b { color: inherit; }
.adm-pw { margin-top: 0.45rem; font-size: 0.9rem; }
.adm-pw summary { padding: 0.5rem 0; cursor: pointer; min-height: 2.5rem; }
.adm-pw code { font-size: 1rem; overflow-wrap: anywhere; }
.adm.success { border-left-color: #2e7d32; background: #f3faf4; }
.adm.danger  { border-left-color: #a30000; background: #fdf4f4; }
.adm.brand   { border-left-color: #7a5900; background: #fffaf0; }
.dxdiag-body { white-space: pre-wrap; word-break: break-word; font-family: monospace; font-size: 0.85rem;
               background: #fff; border: 1px solid var(--line); border-radius: 0.5rem; padding: 0.75rem; }
.rfl { border-left: 0.5rem solid var(--line); border-radius: 0.5rem; padding: 0.55rem 0.7rem;
       margin-bottom: 0.5rem; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.rfl-top { display: flex; justify-content: space-between; gap: 0.5rem; align-items: baseline; flex-wrap: wrap; }
.rfl-user { font-weight: 700; overflow-wrap: anywhere; }
.rfl-time { white-space: nowrap; color: var(--muted); font-size: 0.9rem; }
.rfl-act { margin-top: 0.2rem; overflow-wrap: anywhere; }
.rfl.danger  { border-left-color: #a30000; background: #fdf4f4; }
.rfl.info    { border-left-color: #0b3d91; background: #f4f7fd; }
.rfl.success { border-left-color: #2e7d32; background: #f3faf4; }
.rfl.warning { border-left-color: #c99700; background: #fffdf2; }
.pager { display: flex; gap: 0.75rem; align-items: center; justify-content: center; margin: 0.75rem 0; flex-wrap: wrap; }

/* iBook (iBk) */
.form-static { margin: 0.25rem 0 0.75rem; font-weight: 600; }
/* Commentary tick = speaker icon (on: sound waves, green; off: muted, grey) */
.tick-audio { display: inline-flex; align-items: center; }
.tick-audio svg { width: 1.6rem; height: 1.6rem; fill: currentColor; }
.tick-audio .ico-on { display: none; }
.tick input:checked + .tick-audio { color: #18850a; }
.tick input:checked + .tick-audio .ico-on { display: inline; }
.tick input:checked + .tick-audio .ico-off { display: none; }
.tick input:not(:checked) + .tick-audio { color: #8a8f98; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* Paid tick = rupee badge (green filled when paid, grey outline when not) */
.tick-paid .rupee { display: inline-flex; align-items: center; justify-content: center; width: 1.6rem; height: 1.6rem; border-radius: 50%; border: 2px solid #8a8f98; color: #8a8f98; font-weight: 800; font-size: 1rem; line-height: 1; }
.tick input:checked + .tick-paid .rupee { background: #18850a; border-color: #18850a; color: #ffffff; }

/* Live 3D plan mind-map (app/views/planmap.php, app/assets/planmap.js). Mobile-first: canvas on top,
   side panel below on narrow screens, side-by-side on wide ones. Colours match planmap.js's STATUS_COLOR /
   TYPE_RADIUS so the legend and the canvas always agree. */
.pm-updated { margin-top: -0.25rem; }
.pm-wrap { display: flex; flex-direction: column; gap: 1rem; }
@media (min-width: 62rem) {
    .pm-wrap { flex-direction: row; align-items: flex-start; }
    .pm-canvas-box { flex: 1 1 auto; }
    .pm-panel { flex: 0 0 20rem; }
    /* The .pm-details desktop override (sticky <=360px side card instead of a fixed bottom sheet) lives in
       its OWN media query further down, placed AFTER the base .pm-details rule in source order — both rules
       match at this width, and with equal specificity the later one in the cascade wins, so it must come
       after the base rule or "position: fixed" from the base rule silently wins back on desktop too. */
}
.pm-canvas-box { position: relative; border: 1px solid var(--line); border-radius: 0.6rem; background: #f4f5f7; overflow: hidden; }
.pm-canvas { display: block; width: 100%; height: 60vh; min-height: 20rem; touch-action: none; }
.pm-controls { position: absolute; top: 0.6rem; right: 0.6rem; }
.pm-reset { min-height: var(--tap); padding: 0.5rem 1rem; }
.pm-changed-now { position: absolute; left: 0.6rem; bottom: 0.6rem; margin: 0; padding: 0.5rem 0.8rem;
    background: #fff3d6; border: 1px solid #e07b00; color: #6b4400; border-radius: 0.5rem; font-weight: 700; }

.pm-panel { display: flex; flex-direction: column; gap: 1rem; position: relative; }
.pm-h2 { font-size: 1.05rem; margin: 0 0 0.4rem; }
.pm-legend, .pm-changes, .pm-oq-section { border: 1px solid var(--line); border-radius: 0.6rem; padding: 0.75rem; background: #fff; }

/* Search: label-only filter, big result buttons, no autocomplete cruft. */
.pm-search { position: relative; }
.pm-search-input { width: 100%; min-height: var(--tap); padding: 0.6rem 0.8rem; font: inherit; box-sizing: border-box;
    border: 1px solid var(--line); border-radius: 0.6rem; }
.pm-search-results { list-style: none; margin: 0.3rem 0 0; padding: 0; position: absolute; left: 0; right: 0; z-index: 30;
    background: #fff; border: 1px solid var(--line); border-radius: 0.6rem; box-shadow: 0 4px 12px rgba(0,0,0,.15);
    max-height: 16rem; overflow-y: auto; }
.pm-search-result-btn { display: block; width: 100%; min-height: var(--tap); padding: 0.6rem 0.8rem; text-align: left;
    font: inherit; color: inherit; background: #fff; border: none; border-bottom: 1px solid #eee; cursor: pointer; }
.pm-search-result-btn:last-child { border-bottom: none; }
.pm-search-result-btn:hover, .pm-search-result-btn:focus { background: #f4f5f7; }

/* Details: a small, non-blocking sheet — never a modal, never a full-screen backdrop, never open on load.
 * Gated by plain display:none/block on .pm-details-open (toggled ONLY from explicit user actions in
 * planmap.js: tap a node, pick a search result, tap a connected chip) so a closed sheet is truly gone —
 * removed from the flow and unable to intercept a stray click or cover the canvas — instead of merely
 * hidden off-screen. Mobile-first default = a compact bottom sheet over the lower part of the canvas,
 * capped at 40% of the viewport height and scrollable inside; the canvas above/around it stays pannable.
 * Desktop (see the min-width override below) turns it into a <=360px sticky card in the side panel instead
 * — same markup, no JS branching needed. */
.pm-details { display: none; border: 1px solid var(--line); background: #fff;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; max-height: 40vh; overflow-y: auto;
    padding: 0.75rem; padding-bottom: 1.25rem; border-radius: 0.8rem 0.8rem 0 0; border-bottom: none;
    box-shadow: 0 -6px 20px rgba(0,0,0,.2); }
.pm-details.pm-details-open { display: block; }
/* Desktop: sticky <=360px side card instead of a fixed bottom sheet — MUST stay after the base .pm-details
   rule above (see the comment in the 62rem layout media query) so "position: sticky" wins the cascade. */
@media (min-width: 62rem) {
    .pm-details { position: sticky; left: auto; right: auto; bottom: auto; top: 0.75rem; z-index: 5;
        max-height: 70vh; max-width: 360px; width: 100%; border-radius: 0.6rem; border-bottom: 1px solid var(--line);
        box-shadow: 0 4px 16px rgba(0,0,0,.12); }
}
.pm-details-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.3rem; }
.pm-details-head .pm-h2 { margin: 0; }
.pm-details-close { min-height: var(--tap); padding: 0.5rem 1rem; }

/* Open questions: one card per open question, answerable right here. Purple = matches the "open"/question
 * swatch elsewhere on the map; an answered card gets a check + muted purple background while it waits for
 * the team to act on it (still shown, not hidden, until the data file itself marks it no longer open). */
.pm-oq-empty { margin: 0; }
.pm-oq-card { border: 1px solid var(--line); border-radius: 0.6rem; padding: 0.75rem; margin: 0 0 0.75rem; }
.pm-oq-card:last-child { margin-bottom: 0; }
.pm-oq-card[data-pm-oq-answered="1"] { border-color: #7a3fd6; background: #faf6ff; }
.pm-oq-label { font-weight: 700; margin: 0 0 0.3rem; overflow-wrap: anywhere; }
.pm-oq-why { margin: 0 0 0.6rem; }
.pm-oq-form { display: flex; flex-direction: column; gap: 0.5rem; }
.pm-oq-choices { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.pm-oq-choice-btn { min-height: var(--tap); padding: 0.5rem 0.8rem; }
.pm-oq-textarea { width: 100%; min-height: 6rem; padding: 0.6rem; font: inherit; border: 1px solid var(--line);
    border-radius: 0.5rem; resize: vertical; box-sizing: border-box; }
.pm-oq-save { min-height: var(--tap); align-self: flex-start; padding: 0.5rem 1.2rem; }
.pm-oq-error { color: #a30000; margin: 0; font-weight: 600; }
.pm-oq-answered-box { display: flex; flex-direction: column; align-items: flex-start; gap: 0.5rem; }
.pm-oq-answered-text::before { content: "\2713  "; color: #7a3fd6; font-weight: 700; }
.pm-oq-answered-text { margin: 0; overflow-wrap: anywhere; }
.pm-legend-list { list-style: none; margin: 0 0 0.5rem; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.pm-legend-list li { display: flex; }
.pm-legend-btn { display: flex; align-items: center; gap: 0.4rem; min-height: var(--tap); padding: 0.3rem 0.6rem;
    font-size: 0.92rem; font: inherit; color: inherit; background: #fff; border: 1px solid var(--line);
    border-radius: 1.2rem; cursor: pointer; }
.pm-legend-btn[aria-pressed="true"] { background: #0b3d91; border-color: #0b3d91; color: #fff; font-weight: 700; }
.pm-legend-btn[aria-pressed="true"] .pm-tag { background: rgba(255,255,255,.2); color: #fff; border-color: #fff; }
.pm-count { color: var(--muted); font-size: 0.85rem; min-width: 1.2rem; text-align: right; }
.pm-legend-btn[aria-pressed="true"] .pm-count { color: #fff; }
.pm-swatch { display: inline-block; width: 1.1rem; height: 1.1rem; border-radius: 50%; border: 1px solid rgba(0,0,0,.25); }
.pm-status-live { background: #2ecc40; }
.pm-status-done { background: #145214; }
.pm-status-building { background: #0b62d6; }
.pm-status-planned { background: #8a8f98; }
.pm-status-changed { background: #e07b00; }
.pm-status-dropped { background: #a30000; }
.pm-status-open { background: #7a3fd6; }
.pm-status-blocked { background: #5a0000; }
.pm-shape { display: inline-block; border-radius: 50%; background: var(--muted); }
.pm-shape-goal { width: 1.5rem; height: 1.5rem; }
.pm-shape-area { width: 1.2rem; height: 1.2rem; }
.pm-shape-feature, .pm-shape-decision, .pm-shape-ruling { width: 0.85rem; height: 0.85rem; }
.pm-shape-suggestion, .pm-shape-question { width: 0.65rem; height: 0.65rem; }
.pm-tag { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 1rem; border: 1px solid var(--line);
    font-size: 0.8rem; background: #f4f5f7; }

.pm-details .empty { color: var(--muted); }
.pm-d-label { font-weight: 700; font-size: 1.05rem; margin: 0 0 0.4rem; overflow-wrap: anywhere; }
.pm-d-label.pm-strike { text-decoration: line-through; color: var(--muted); }
.pm-d-row { display: flex; align-items: center; gap: 0.4rem; margin: 0.2rem 0; font-size: 0.92rem; }
.pm-d-key { color: var(--muted); min-width: 4.5rem; }
.pm-d-why { margin-top: 0.5rem; overflow-wrap: anywhere; }
/* Status chip: same colour language as the legend swatches (.pm-status-x sets the background), just shaped
   and coloured to read as a badge rather than a dot. */
.pm-status-chip { display: inline-block; padding: 0.15rem 0.7rem; border-radius: 1rem; font-weight: 700;
    font-size: 0.85rem; color: #fff; }
.pm-d-links { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.6rem; }
.pm-d-link-chip { min-height: var(--tap); padding: 0.4rem 0.8rem; font: inherit; font-size: 0.88rem; color: inherit;
    background: #f4f5f7; border: 1px solid var(--line); border-radius: 1rem; cursor: pointer; }
.pm-d-link-chip:hover, .pm-d-link-chip:focus { background: #e4e4e4; }
.pm-d-oq { margin-top: 0.75rem; }
.pm-d-oq .pm-oq-card { margin: 0; }

.pm-changes-list { list-style: none; margin: 0; padding: 0; max-height: 16rem; overflow-y: auto; }
.pm-changes-list .empty { color: var(--muted); padding: 0.4rem 0; }
.pm-change { display: flex; flex-direction: column; gap: 0.1rem; padding: 0.5rem 0; border-bottom: 1px solid #eee; }
.pm-change:last-child { border-bottom: none; }
.pm-change-at { font-size: 0.8rem; color: var(--muted); }
.pm-change-text { overflow-wrap: anywhere; }
.pm-changes-showall { min-height: var(--tap); width: 100%; margin-top: 0.5rem; padding: 0.5rem; }

.pm-h3 { font-size: 0.92rem; margin: 0.9rem 0 0.4rem; color: var(--muted); }
.pm-bar { display: flex; height: 0.9rem; border-radius: 0.5rem; overflow: hidden; background: #e4e4e4;
    border: 1px solid var(--line); }
.pm-bar-seg { display: block; height: 100%; }
.pm-bar-done_live { background: #2ecc40; }
.pm-bar-building { background: #0b62d6; }
.pm-bar-planned { background: #8a8f98; }
.pm-bar-blocked { background: #5a0000; }
.pm-bar-changed { background: #e07b00; }
.pm-progress-pct { font-size: 1.3rem; font-weight: 700; margin: 0.5rem 0 0.2rem; }
.pm-progress-line { margin: 0 0 0.6rem; }
.pm-oq-btn { display: flex; width: 100%; min-height: var(--tap); align-items: center; justify-content: center;
    padding: 0.5rem 0.8rem; font: inherit; font-weight: 600; color: inherit; background: #fff;
    border: 1px solid var(--line); border-radius: 0.6rem; cursor: pointer; }
.pm-oq-btn[aria-pressed="true"] { background: #0b3d91; border-color: #0b3d91; color: #fff; }
.pm-area-bars { display: flex; flex-direction: column; gap: 0.6rem; }
.pm-area-row { display: flex; flex-direction: column; gap: 0.2rem; }
.pm-area-label { margin: 0; font-size: 0.88rem; overflow-wrap: anywhere; }
.pm-area-bar { height: 0.6rem; }
.pm-area-frac { margin: 0; font-size: 0.82rem; color: var(--muted); }

/* ---------- navigation (owner-approved UX 2026-09-26, lib/nav.php): 4-item strip, chip rows, banner line, More page ---------- */
[hidden] { display: none !important; }
.topbar .credit-badge { color: #ffffff; min-height: 0; padding: 0; font-size: 0.95rem; }
.topbar .actor-badge { font-size: 0.85rem; }
.tabs.strip { flex-wrap: nowrap; gap: 0; padding: 0 0.25rem; }
.tabs.strip a { flex: 1 1 0; justify-content: center; padding: 0 0.25rem; font-size: 1rem; white-space: nowrap; min-width: 0; }
.navchips { flex-wrap: nowrap; overflow-x: auto; margin: 0; padding: 0.5rem 1rem; border-bottom: 1px solid var(--line); background: #ffffff; }
.navchips .chip { align-items: center; min-height: var(--tap); padding: 0 0.9rem; border: 2px solid var(--line); border-radius: 1.5rem;
    white-space: nowrap; color: var(--brand); background: #ffffff; font: inherit; font-size: 1rem; font-weight: 600; text-decoration: none; cursor: pointer; }
.navchips .chip[aria-current="page"] { color: #ffffff; background: var(--brand); border-color: var(--brand); }
.banner-line { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; min-height: var(--tap);
    padding: 0 1rem; background: #fff8d6; border-bottom: 1px solid var(--line); font-size: 0.95rem; }
.banner-line a { color: var(--fg); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.banner-line .link-btn { min-height: var(--tap); color: var(--brand); flex: 0 0 auto; }
.more-page .in { display: block; width: 100%; min-height: var(--tap); font: inherit; padding: 0.4rem 0.6rem; border: 2px solid var(--line); border-radius: 0.5rem; margin: 0 0 0.5rem; }
.more-group h2 { margin: 1rem 0 0.25rem; }
.more-row { margin: 0; }
.more-link { display: flex; flex-direction: column; align-items: flex-start; width: 100%; min-height: 3.5rem; margin: 0.4rem 0; padding: 0.55rem 0.8rem;
    color: var(--fg); background: #ffffff; border: 2px solid var(--line); border-radius: 0.6rem; font: inherit; text-align: left; text-decoration: none; cursor: pointer; }
.more-link:hover { border-color: var(--brand); }
.more-l { font-weight: 700; color: var(--brand); }
.more-h { font-size: 0.9rem; color: var(--muted); }
.rate-in { max-width: 6em; }
.net-sheet form, .net-sheet a { display: block; margin: 0.5rem 0; }
