/* ---------- components/baddebts/baddebts.css ---------- */
/* ===== bad debts =====
   Drawn inside #baddebts. Shown while the Bad debts button in the footer is on (body.bd-open); the ledger / stockbook / zakat parts are hidden meanwhile.
   Uses the app's own colours (--bg --card --text --mute --line --accent --err), so dark / light follow the UMAR switch. */
#baddebts{display:none}
body.bd-open #baddebts{display:block}
body.bd-open .frz .bar,body.bd-open .frz .batch,body.bd-open .frz .filters,body.bd-open .frz .quote,body.bd-open .frz #sum,body.bd-open #list,body.bd-open #pager,body.bd-open #stockbook,body.bd-open #pricelist,body.bd-open #zakat{display:none!important}
body.pub #baddebts,body.pub #bdBtn{display:none!important}

.bd-back{height:36px;min-width:38px;padding:0 10px;border-radius:10px;border:1px solid var(--line);background:var(--card);color:var(--text);display:inline-flex;align-items:center;justify-content:center;cursor:pointer}
.bd-back svg{display:block}
.bd-big{font-size:26px;font-weight:800;font-variant-numeric:tabular-nums;line-height:1.25;margin-top:2px}
.bd-big.red{color:var(--err)}
.bd-note0{text-align:center;color:var(--mute);font-size:12.5px;margin:8px 0 6px}
.bd-row{display:flex;align-items:center;gap:8px;width:100%;margin:0;padding:9px 12px;border:0;border-bottom:1px solid var(--line);border-radius:0;background:var(--card);color:var(--text);font:inherit;text-align:left;cursor:pointer}
.bd-rn{flex:1;min-width:0}
.bd-rn b{display:block;font-size:15px;line-height:1.3;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.bd-rn small{display:block;color:var(--mute);font-size:12px;line-height:1.3;margin-top:1px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.bd-ra{flex:none;min-width:78px;text-align:right;font-size:15px;font-weight:700;font-variant-numeric:tabular-nums;color:var(--err)}
.bd-ra.bd-good{color:var(--accent);font-size:12.5px}
.bd-pd{flex:none;min-width:72px;text-align:right;font-size:13.5px;color:var(--mute);font-variant-numeric:tabular-nums}
.bd-pd.green{color:var(--accent);font-weight:700;font-size:15px}
/* ledger table: header line, one line per person, total line */
.bd-th{display:flex;gap:8px;padding:8px 12px;font-size:12.5px;color:var(--mute);border-bottom:1px solid var(--line);position:sticky;top:var(--bd-top,0px);z-index:5;background:var(--bg)}
.bd-th span:first-child{flex:1}
.bd-th span:nth-child(2){width:78px;text-align:right}
.bd-th span:nth-child(3){width:72px;text-align:right}
.bd-tot{display:flex;align-items:center;gap:8px;padding:11px 12px;background:var(--card);border-bottom:1px solid var(--line);border-radius:12px 12px 0 0;font-weight:700}
/* list screen: entry bar + search bar frozen under the page header */
.bd-fz{position:sticky;top:var(--bd-top,0px);z-index:20;background:var(--bg);padding-bottom:8px}
.bd-fz .bd-eb{margin-bottom:8px}
.bd-fz .bd-q{margin:0}
.bd-tot span:first-child{flex:1}
.bd-more{display:block;width:100%;margin-top:10px;min-height:42px;flex:none}
.bd-none{color:var(--mute);padding:18px 2px;text-align:center}
.bd-b{min-height:46px;padding:0 16px;border-radius:12px;border:1px solid var(--accent);background:none;color:var(--accent);font:inherit;font-weight:700;text-align:center;cursor:pointer;flex:1}
.bd-b.solid{background:var(--accent);color:var(--bg)}
.bd-b.sec{color:var(--text);border-color:var(--line)}
.bd-lbl{font-size:13px;font-weight:700;color:var(--mute);margin:12px 2px 4px}
.bd-in{display:block;width:100%;min-width:0;border:1px solid var(--line);border-radius:12px;background:var(--card);color:var(--text);padding:13px 14px;font:inherit;font-size:16px}
.bd-in:focus{outline:0;border-color:var(--accent)}
textarea.bd-in{resize:vertical;min-height:70px;line-height:1.4}
.bd-sub{min-height:18px;margin:6px 2px 0;font-size:13px;color:var(--mute)}
.bd-sub.bd-warn{color:var(--err)}
.bd-two{color:var(--mute);font-size:13.5px;margin-top:8px}
.bd-two b{color:var(--text)}
.bd-h{display:flex;align-items:center;gap:10px;padding:11px 2px;border-top:1px solid var(--line);font-variant-numeric:tabular-nums}
.bd-h span{flex:1;font-size:15px}
.bd-h small{color:var(--mute);font-size:12.5px}
.bd-h b{font-size:15px}
.bd-h.m b,.bd-h.a b{color:var(--err)}.bd-h.r b{color:var(--accent)}
.bd-gate{display:flex;flex-direction:column;align-items:center;gap:10px;padding:36px 0}
.bd-err{min-height:18px;color:var(--err);font-size:13px}

/* the owed amount (profile) stays frozen under the page header while scrolling */
.bd-pcard{position:sticky;top:var(--bd-top,0px);z-index:5;box-shadow:0 0 0 6px var(--bg)}

/* the entry bar (list and profile): ONE line like the main ledger: Name, Note, Amount, Save. The hint line sits under it. */
.bd-eb{display:flex;flex-wrap:wrap;align-items:center;gap:6px;margin:4px 0 12px}
.bd-eb .bd-in{padding:10px 8px;border-radius:10px;min-width:0}
.bd-eb .bd-nw{flex:1 1 0;order:1;min-width:0;position:relative}
.bd-eb #bdEt{flex:1.3 1 0;order:2}
.bd-eb .bd-aw{flex:0 0 92px;order:3;position:relative}
.bd-eb .bd-aw.sg{flex-basis:130px}
.bd-eb .am{text-align:right}
.bd-eb .bd-aw.sg .am{padding-left:46px}
.bd-eb .bd-sv{flex:0 0 44px;order:4;min-height:42px;padding:0;display:inline-flex;align-items:center;justify-content:center}
.bd-eb div.nt{flex:1 0 100%;order:7;margin:0 2px;min-height:0}
/* on a computer there is no Save button: Enter saves (the button stays on phones and tablets) */
@media (hover:hover) and (pointer:fine){.bd-eb .bd-sv{display:none}}
.bd-eb .bd-sub:empty{display:none}

/* profile: ONE compact card = back, name + small WhatsApp number (with the WhatsApp icon), and what is still owed */
.bd-pcard{display:flex;align-items:center;gap:10px;margin:4px 0 8px;padding:10px 12px;background:var(--card);border-radius:14px}
.bd-pcard .bd-back{flex:none;height:34px;min-width:34px;padding:0 8px}
.bd-pm{flex:1;min-width:0}
.bd-pm>b{display:block;font-size:16px;line-height:1.3;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.bd-pp{display:flex;align-items:center;gap:4px;margin-top:1px}
.bd-ph-in{flex:1;min-width:0;border:0;border-bottom:1px dashed var(--line);border-radius:0;background:none;color:var(--mute);padding:2px 0;font:inherit;font-size:12.5px}
.bd-ph-in:focus{outline:0;border-bottom-color:var(--accent);color:var(--text)}
.bd-wa-s{flex:none;display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;border-radius:8px;background:var(--accent);color:var(--bg);text-decoration:none}
.bd-wa-s svg{width:15px;height:15px}
.bd-wa-s.off{background:none;color:var(--mute);pointer-events:none;border:1px solid var(--line)}
.bd-pa{flex:none;text-align:right}
.bd-pa small{display:block;color:var(--mute);font-size:11.5px}
.bd-pa .bd-big{font-size:20px;line-height:1.2;margin-top:0}
.bd-pa .bd-two{margin-top:2px;font-size:11.5px}
.bd-pn{min-height:48px;padding:9px 12px;font-size:14px}
.bd-del{flex:none;width:34px;height:34px;padding:0;border-radius:10px;border:1px solid var(--line);background:none;color:var(--mute);display:inline-flex;align-items:center;justify-content:center;cursor:pointer}
.bd-del.arm{background:var(--err);border-color:var(--err);color:#fff}
.bd-q{margin:0 0 4px;padding:9px 12px;font-size:14px}
.bd-x{flex:none;width:26px;height:26px;padding:0;border:0;border-radius:8px;background:none;color:var(--mute);font-size:20px;line-height:1;cursor:pointer}
.bd-x.arm{background:var(--err);color:#fff}

/* phones: fields under 16px make iPhones zoom the page when you tap them */
@media (pointer:coarse){.bd-q,.bd-pn,.bd-ph-in,.bd-mi input{font-size:16px}}

/* name drop list (replaces the browser's own list, which is tiny and unreliable on phones) */
.bd-dd{position:absolute;left:0;right:0;top:100%;margin-top:4px;z-index:30;max-height:240px;overflow-y:auto;background:var(--card);border:1px solid var(--line);border-radius:12px;box-shadow:0 8px 24px rgba(0,0,0,.28)}
.bd-dd[hidden]{display:none}
.bd-di{display:flex;align-items:center;justify-content:space-between;gap:10px;width:100%;min-height:46px;padding:10px 14px;border:0;border-bottom:1px solid var(--line);background:none;color:var(--text);font:inherit;font-size:15px;text-align:left;cursor:pointer}
.bd-di:last-child{border-bottom:0}
.bd-di:hover,.bd-di:active,.bd-di.on{background:var(--line)}
.bd-di span{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.bd-di small{flex:none;color:var(--err);font-size:12.5px;font-variant-numeric:tabular-nums}
.bd-di small.bd-clr{color:var(--accent)}
/* plus / minus button inside the Amount box (phones and tablets only) */
.bd-sg{position:absolute;left:5px;top:50%;transform:translateY(-50%);width:36px;height:34px;padding:0;border:1px solid var(--line);border-radius:8px;background:none;color:var(--mute);font-size:20px;line-height:1;cursor:pointer}
.bd-sg.on{background:var(--err);border-color:var(--err);color:#fff}
/* phones: two lines, big touch targets. Line 1 = Name + Amount, line 2 = Note + Save, then the hint */
@media (max-width:600px){
.bd-eb{gap:8px}
.bd-eb .bd-in{padding:12px;min-height:46px;box-sizing:border-box}
.bd-eb .bd-aw .am{padding-right:12px}
.bd-eb .bd-nw{flex:1 1 calc(100% - 170px)}
.bd-eb .bd-aw,.bd-eb .bd-aw.sg{flex:0 0 160px;order:2}
.bd-eb #bdEt{flex:1 1 50%;order:3}
.bd-eb .bd-sv{flex:0 0 54px;min-height:46px;order:4}
}

/* entry bar: gold glow (works in dark and light) */
.bd-eb{--gold:#d4af37;--gold-hi:#f0cf5a;--gold-glow:rgba(212,175,55,.45)}
.bd-eb .bd-in{border-color:var(--gold);box-shadow:0 0 8px var(--gold-glow);transition:box-shadow .25s,border-color .25s}
.bd-eb .bd-in:focus{border-color:var(--gold-hi);box-shadow:0 0 0 1px var(--gold-hi),0 0 16px 2px rgba(240,207,90,.65)}
.bd-eb .bd-sv{background:var(--gold);border-color:var(--gold);color:#241c00;box-shadow:0 0 10px var(--gold-glow)}
.bd-dd{border-color:var(--gold-hi,#f0cf5a)}
/* search bar: same gold glow as the entry bar */
.bd-q{border-color:#d4af37;box-shadow:0 0 8px rgba(212,175,55,.45);transition:box-shadow .25s,border-color .25s}
.bd-q:focus{border-color:#f0cf5a;box-shadow:0 0 0 1px #f0cf5a,0 0 16px 2px rgba(240,207,90,.65)}

/* description of a history line */
.bd-hn{display:block;color:var(--mute);font-size:13px;font-style:normal;margin-top:1px;overflow-wrap:anywhere}

/* name drop list: the whole entry bar sits above the frozen profile card, so nothing (the WhatsApp button) shows through the list */
.bd-eb{position:relative;z-index:20}
.bd-dd{z-index:40}

/* name drop list: thin, quiet scrollbar */
.bd-dd{scrollbar-width:thin;scrollbar-color:var(--line) transparent}
.bd-dd::-webkit-scrollbar{width:4px}
.bd-dd::-webkit-scrollbar-track{background:transparent}
.bd-dd::-webkit-scrollbar-thumb{background:var(--line);border-radius:4px}

/* profile card: back, name, amount owed, menu. WhatsApp reminder / number / delete are in the menu */
.bd-pn2{flex:1;min-width:0;font-size:16px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.bd-pamt{flex:none;font-size:18px;font-weight:800;color:var(--err);font-variant-numeric:tabular-nums}
.bd-pamt.bd-clr{color:var(--accent);font-size:13px;font-weight:700}
.bd-mb{flex:none;width:34px;height:34px;padding:0;border:0;border-radius:10px;background:none;color:var(--mute);display:inline-flex;align-items:center;justify-content:center;cursor:pointer}
.bd-mn{position:absolute;right:8px;top:calc(100% + 4px);z-index:30;min-width:220px;background:var(--card);border:1px solid var(--line);border-radius:12px;box-shadow:0 8px 24px rgba(0,0,0,.28);overflow:hidden}
.bd-mn[hidden]{display:none}
.bd-mi{display:flex;align-items:center;gap:10px;width:100%;min-height:46px;padding:8px 14px;border:0;border-top:1px solid var(--line);border-radius:0;background:none;color:var(--text);font:inherit;font-size:15px;text-align:left;text-decoration:none;cursor:pointer;box-sizing:border-box}
.bd-mn>:first-child{border-top:0}
.bd-mi.off{color:var(--mute)}
.bd-mi.off svg{opacity:.5}
.bd-mi input{flex:1;min-width:0;border:0;background:none;color:var(--text);font:inherit;font-size:15px;padding:0}
.bd-mi input:focus{outline:0}
.bd-mdel{color:var(--err)}
.bd-mdel.arm{background:var(--err);color:#fff}