/* SuperShop Member Portal — mobile-first, matches the admin design language.
   Layers on shared styles.css (never edits it). Light theme, English. */

body { background: #f4f5f7; }
#app { padding-bottom: 76px; }   /* room for the fixed bottom nav (mobile) */

/* ── login extras ────────────────────────────────────────────────────────── */
.or { display: flex; align-items: center; gap: .6rem; margin: .9rem 0 .8rem; color: var(--ink-faint); font-size: .78rem; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.link { border: 0; background: transparent; color: var(--accent-deep); font-weight: 600; cursor: pointer; }
input.big { font-size: 1.3rem; text-align: center; letter-spacing: .25em; }

/* ── app bar ─────────────────────────────────────────────────────────────── */
.appbar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: .7rem;
  background: #fff; border-bottom: 1px solid var(--line); padding: .7rem 1rem;
  padding-top: calc(.7rem + env(safe-area-inset-top)); }
.avatar { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-deep); font-weight: 700; flex: 0 0 auto; }
.appbar-title { flex: 1; min-width: 0; }
.appbar-title h1 { margin: 0; font-size: 1.1rem; font-weight: 800; line-height: 1.1; }
.appbar-title p { margin: 0; font-size: .76rem; color: var(--ink-faint); }
.iconbtn { display: inline-grid; place-items: center; width: 34px; height: 34px; border: 0; background: transparent; cursor: pointer; color: var(--ink-soft); }
.iconbtn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.appmain { max-width: 560px; margin: 0 auto; padding: 1rem; }
.section { display: none; }
.section.active { display: block; }
.section > * + * { margin-top: 1rem; }

/* ── cards ───────────────────────────────────────────────────────────────── */
.card { background: #fff; border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 1px 2px rgba(28,27,23,.04); padding: 1rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: .6rem; }
.card-head h2 { margin: 0; font-size: 1rem; font-weight: 700; }
.list-card { padding: .4rem 1rem; }
.list-card .card-head { padding-top: .6rem; }

/* ── current dues card ───────────────────────────────────────────────────── */
.dues-card { border-radius: 18px; padding: 1.3rem 1.2rem; text-align: center; box-shadow: 0 1px 2px rgba(28,27,23,.05); }
.dues-card.clear { background: var(--accent-soft); }
.dues-card.owed { background: var(--danger-soft); }
.dues-k { font-size: .82rem; color: var(--ink-soft); font-weight: 600; }
.dues-v { font-size: 2.6rem; font-weight: 800; line-height: 1.1; margin: .2rem 0; }
.dues-card.clear .dues-v { color: var(--accent-deep); }
.dues-card.owed .dues-v { color: var(--danger); }
.dues-sub { font-size: .78rem; color: var(--ink-soft); }

/* ── mini stat row ───────────────────────────────────────────────────────── */
.stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.mini-stat { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: .7rem .85rem; box-shadow: 0 1px 2px rgba(28,27,23,.04); }
.mini-stat .k { font-size: .74rem; color: var(--ink-soft); }
.mini-stat .v { font-size: 1.35rem; font-weight: 800; }

/* ── transaction rows ────────────────────────────────────────────────────── */
.txn { display: flex; align-items: center; gap: .7rem; width: 100%; text-align: left; border: 0;
  background: transparent; cursor: pointer; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.txn:last-child { border-bottom: 0; }
.txn.is-voided { opacity: .55; }
.datechip { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 11px;
  background: var(--paper); border: 1px solid var(--line); font-size: .95rem; font-weight: 700; line-height: 1; flex: 0 0 auto; }
.datechip b { font-size: .6rem; font-weight: 600; color: var(--ink-faint); text-transform: uppercase; }
.txn-main { flex: 1; min-width: 0; }
.txn-name { display: block; font-weight: 600; }
.txn-sub { display: block; font-size: .76rem; color: var(--ink-faint); }
.txn-right { text-align: right; }
.txn-amt { display: block; font-weight: 700; }
.txn-status { font-size: .74rem; }
.txn-status.green, .st-green { color: var(--accent-deep); }
.txn-status.amber, .st-amber { color: var(--warn); }
.txn-status.red, .st-red { color: var(--danger); }
.txn-status.muted, .st-muted { color: var(--ink-faint); }
.chev { color: var(--ink-faint); display: inline-grid; place-items: center; flex: 0 0 auto; }
.chev svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; }

/* ── dues ledger rows ────────────────────────────────────────────────────── */
.led-row { display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.led-row:last-child { border-bottom: 0; }
.led-label { font-weight: 600; }
.led-amt { font-weight: 700; }
.led-amt.credit { color: var(--accent-deep); }
.led-amt.debit { color: var(--danger); }

/* ── receipt detail ──────────────────────────────────────────────────────── */
.backbtn { display: inline-flex; align-items: center; gap: .3rem; border: 0; background: transparent;
  cursor: pointer; color: var(--accent-deep); font-weight: 600; padding: .2rem 0; margin-bottom: .6rem; }
.backbtn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; }
.r-line.owe span { color: var(--danger); }
.detail-actions { margin-top: .7rem; display: flex; gap: .5rem; }
.detail-actions .btn { flex: 1; }

/* ── bottom nav ──────────────────────────────────────────────────────────── */
.bottomnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: flex;
  background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
  max-width: 560px; margin: 0 auto; }
.navbtn { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; border: 0;
  background: transparent; cursor: pointer; padding: .55rem 0; color: var(--ink-faint); font-size: .7rem; }
.navbtn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.navbtn.active { color: var(--accent-deep); }

.mono { font-family: var(--mono); }

/* focus + reduced motion */
#app input:focus, #app button:focus-visible, .auth-card input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }

/* desktop: centered, no floating bar feel (it's already constrained to 560px) */
@media (min-width: 760px) {
  #app { padding-bottom: 0; }
  .bottomnav { position: sticky; bottom: 0; border-radius: 0 0 16px 16px; }
}

/* ── order: dashboard CTA, picker, order cart, my-orders ───────────────────── */
.order-cta { display: flex; align-items: center; gap: .7rem; width: 100%; text-align: left; cursor: pointer;
  border: 1px solid var(--accent); border-radius: 14px; background: var(--accent-soft);
  color: var(--accent-deep); padding: .85rem 1rem; }
.order-cta-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .1rem; }
.order-cta-main b { font-size: .98rem; }
.order-cta-main .tiny { color: var(--ink-soft); }
.order-cta .chev svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; }

.order-search { width: 100%; margin-bottom: .7rem; padding: .55rem .7rem; }
.order-picker { max-height: 46vh; overflow: auto; }
.ord-pick { display: flex; align-items: center; gap: .7rem; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.ord-pick:last-child { border-bottom: 0; }
.ord-pick-main { flex: 1; min-width: 0; }
.ord-pick-name { font-weight: 600; }
.stock-ok { color: var(--accent-deep); }
.stock-low { color: var(--warn); }
.stock-out { color: var(--ink-faint); }            /* out-of-stock = muted */
.ord-cap-note { color: var(--warn); margin-top: .15rem; }

.ord-line { display: flex; align-items: center; gap: .6rem; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.ord-line:last-child { border-bottom: 0; }
.ord-line-main { flex: 1; min-width: 0; }
.ord-line-tot { font-weight: 700; min-width: 64px; text-align: right; }
.qtybox { display: inline-flex; align-items: center; gap: .5rem; }
.qtybox span { min-width: 1.4em; text-align: center; font-weight: 700; }
.order-total-row { display: flex; align-items: center; justify-content: space-between;
  border-top: 1px solid var(--line); margin-top: .6rem; padding-top: .7rem; font-weight: 700; }
.order-total-row .mono { font-size: 1.2rem; }

.ord-card { border: 1px solid var(--line); border-radius: 12px; margin-bottom: .55rem; overflow: hidden; }
.ord-card:last-child { margin-bottom: 0; }
.ord-head { display: flex; align-items: center; gap: .7rem; width: 100%; text-align: left; border: 0;
  background: #fff; cursor: pointer; padding: .6rem .7rem; }
.ord-head-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .1rem; }
.ord-title { font-weight: 700; }
.ord-badge { font-size: .68rem; font-weight: 700; padding: .12rem .5rem; border-radius: 999px; white-space: nowrap; }
.ord-badge.amber { background: var(--warn-soft); color: var(--warn); }
.ord-badge.green { background: var(--accent-soft); color: var(--accent-deep); }
.ord-badge.muted { background: var(--paper); color: var(--ink-faint); }
.ord-badge.blue { background: #e3edf9; color: #1d5ca8; }
.ord-body { padding: .3rem .8rem .8rem; border-top: 1px dashed var(--line); background: var(--paper); }
.ord-lines { padding-top: .4rem; }
.ord-line-total { border-top: 1px solid var(--line); margin-top: .35rem; padding-top: .35rem; font-weight: 700; }
.ord-cancel { margin-top: .7rem; }
.btn.danger { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.ord-meta { margin-top: .25rem; }

/* ── dispatched-order delivery confirmation (Received / Not received) ───────── */
.ord-delivery { margin-top: .7rem; }
.ord-delivery-btns { display: flex; gap: .5rem; flex-wrap: wrap; }
.ord-delivery-btns .btn { flex: 1; min-width: 130px; }
.ord-flag { margin-bottom: .4rem; font-weight: 600; }
.ord-flag.ok { color: var(--accent-deep); }
.ord-flag.warn { color: var(--danger); }
/* not-received confirmation popup (5s arming timer before confirm activates) */
.nr-overlay { position: fixed; inset: 0; background: rgba(15, 23, 32, .45); z-index: 60;
  display: flex; align-items: center; justify-content: center; padding: 1rem; }
.nr-modal { background: #fff; border-radius: 14px; padding: 1rem; max-width: 340px; width: 100%;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .25); }
.nr-title { font-weight: 700; margin-bottom: .35rem; }
.nr-text { font-size: .9rem; margin-bottom: .8rem; }
.nr-actions { display: flex; gap: .5rem; justify-content: flex-end; }
.nr-actions .nr-confirm[disabled] { opacity: .55; }
