/* ============================================================
   Endurance Foods - shared styles
   Same system as the other Endurance apps: paper, carbon ink, one red
   (used for money owed and alerts). Zero radius. Phone first.
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Archivo:wght@500;600;700;800;900&family=IBM+Plex+Mono:wght@500;600;700&display=swap');

:root {
  --ink: #0E0E0E;
  --red: #DA251D;
  --red-soft: #fbe9e8;
  --paper: #F4F4F2;
  --white: #FFFFFF;
  --rule: #DCDCD8;
  --muted: #6B6B67;
  --faint: #B7B7B2;
  --good: #1f7a4d;
  --good-bg: #e7f3ec;
  --display: 'Archivo', 'Arial Narrow', sans-serif;
  --mono: 'IBM Plex Mono', Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--display); font-size: 15px; line-height: 1.45;
  background: var(--paper); color: var(--ink); -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }

/* ---------- controls ---------- */
.lbl {
  display: block; margin: 0 0 6px;
  font-family: var(--mono); font-size: 11px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
}
.in {
  width: 100%; height: 48px; padding: 0 12px;
  background: var(--white); border: 1px solid var(--rule); border-radius: 0;
  font-size: 16px; font-weight: 500;
}
.in:focus { outline: 2px solid var(--red); outline-offset: 1px; border-color: var(--red); }
.in[readonly] { background: var(--paper); color: var(--ink); }
.in.mono { font-family: var(--mono); }
select.in { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 18px) 21px, calc(100% - 13px) 21px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 18px; border: 1px solid var(--ink); border-radius: 0;
  background: var(--white); color: var(--ink);
  font-size: 15px; font-weight: 800; text-decoration: none; cursor: pointer;
  transition: background .15s ease, color .15s ease, transform .12s ease;
}
.btn:hover { background: var(--ink); color: var(--white); }
.btn:active { transform: translateY(1px); }
.btn--ink { background: var(--ink); color: var(--white); }
.btn--ink:hover { background: var(--red); border-color: var(--red); }
.btn--red { background: var(--red); border-color: var(--red); color: var(--white); }
.btn--red:hover { background: #b81d16; border-color: #b81d16; }
.btn--block { width: 100%; }
.btn--sm { height: 40px; padding: 0 14px; font-size: 13px; }
.btn--ghost { border-style: dashed; background: transparent; }

.field { min-width: 0; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 14px; }

/* ---------- top bar (signed-in pages) ---------- */
.bar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; background: var(--ink); color: var(--white);
  border-bottom: 3px solid var(--red);
}
.bar__brand { display: flex; align-items: center; gap: 10px; min-width: 0; text-decoration: none; }
.bar__brand img { width: 30px; height: 30px; background: var(--white); padding: 3px; flex: none; }
.bar__brand small { display: block; font-family: var(--mono); font-size: 10px; letter-spacing: .08em; color: #c9c9c4; text-transform: uppercase; }
.bar__brand b { display: block; font-size: 17px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar__acts { display: flex; gap: 6px; flex: none; }
.bar__acts .btn { height: 38px; padding: 0 12px; font-size: 13px; background: transparent; color: var(--white); border-color: #555; }
.bar__acts .btn:hover { background: var(--white); color: var(--ink); }
.bar__acts .btn--out { border-color: var(--red); color: #ff8a84; }

.page { max-width: 1240px; margin: 0 auto; padding: 16px 16px 120px; }
.head { padding: 14px 0 16px; }
.head .eyebrow { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.head h1 { margin: 2px 0 0; font-size: clamp(28px, 7vw, 40px); font-weight: 900; letter-spacing: -.02em; line-height: 1.05; text-transform: uppercase; }
.head h1 i { font-style: normal; color: var(--red); }

.panel { background: var(--white); border: 1px solid var(--rule); border-top: 3px solid var(--ink); padding: 16px; }
.panel__title { display: flex; align-items: baseline; justify-content: space-between; margin: 0 0 14px; font-size: 13px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.panel__title span { font-family: var(--mono); font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: 0; text-transform: none; }

/* ---------- billing layout ---------- */
.bill { display: grid; gap: 14px; }
@media (min-width: 980px) {
  .bill { grid-template-columns: 320px minmax(0, 1fr) 320px; align-items: start; }
  .bill__sum { position: sticky; top: 76px; }
}

/* live amount under the add-item inputs */
.preview { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 12px; background: var(--paper); border: 1px dashed var(--rule); font-family: var(--mono); font-size: 13px; }
.preview b { font-size: 18px; }

/* item list: a table on desktop, cards on phones */
.items { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 13px; }
.items th { background: var(--ink); color: var(--white); font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; text-align: right; padding: 10px 12px; }
.items th:first-child { text-align: left; }
.items td { padding: 10px 12px; border-bottom: 1px solid var(--rule); text-align: right; }
.items td:first-child { text-align: left; font-family: var(--display); font-weight: 700; font-size: 14px; }
.items td.neg { color: var(--red); font-weight: 700; }
.items .del { height: 34px; padding: 0 12px; border: 1px solid var(--red); background: transparent; color: var(--red); font: 700 12px var(--display); cursor: pointer; }
.items .del:hover { background: var(--red); color: var(--white); }
.items-empty { padding: 28px 12px; text-align: center; color: var(--muted); border: 1px dashed var(--rule); font-size: 14px; }
.items-foot { display: flex; justify-content: space-between; gap: 12px; margin-top: 12px; padding: 12px 14px; background: var(--ink); color: var(--white); border-top: 3px solid var(--red); font-family: var(--mono); }
.items-foot > div > span { font-size: 11px; color: #c9c9c4; text-transform: uppercase; letter-spacing: .06em; display: block; }
.items-foot b { white-space: nowrap; }
.items-foot b { font-size: 17px; }

@media (max-width: 720px) {
  .items thead { display: none; }
  .items, .items tbody { display: block; }
  .items tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 10px; padding: 12px; margin-bottom: 10px; background: var(--white); border: 1px solid var(--rule); }
  .items td { display: flex; flex-direction: column; gap: 2px; padding: 0; border: 0; text-align: left; min-width: 0; }
  .items td::before { content: attr(data-label); font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
  .items td:first-child { grid-column: 1 / -1; font-size: 16px; }
  .items td:first-child::before, .items td:last-child::before { display: none; }
  .items td:last-child { grid-column: 1 / -1; }
  .items .del { width: 100%; }
}

/* summary card */
.sum { background: var(--ink); color: var(--white); padding: 16px; border-top: 3px solid var(--red); }
.sum__cust { font-size: 17px; font-weight: 800; min-height: 1.4em; }
.sum__cust small { display: block; font-family: var(--mono); font-size: 11px; font-weight: 600; color: #c9c9c4; text-transform: uppercase; letter-spacing: .06em; }
.sum__rows { margin: 14px 0; border-top: 1px solid #333; }
.sum__row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 9px 0; border-bottom: 1px solid #333; font-family: var(--mono); font-size: 14px; }
.sum__row span { color: #c9c9c4; font-family: var(--display); font-size: 13px; }
.sum__row b { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.sum__row.big b { font-size: 22px; }
.sum__row input { width: 120px; height: 38px; text-align: right; background: #1c1c1c; border: 1px solid #444; color: var(--white); font-family: var(--mono); font-size: 16px; padding: 0 8px; }
.sum__row input:focus { outline: 2px solid var(--red); }
.sum__row input[readonly] { width: 10ch; background: transparent; border-color: transparent; padding: 0; font-weight: 700; }
.sum .lbl { color: #c9c9c4; }
.sum .in { background: #1c1c1c; border-color: #444; color: var(--white); }
.sum select.in { background-image: linear-gradient(45deg, transparent 50%, #fff 50%), linear-gradient(135deg, #fff 50%, transparent 50%); }
#balanceAmount.positive { color: #6fd39b; }
#balanceAmount.negative { color: #ff6a6e; }
.pay { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border: 1px solid #555; }
.pay label { display: flex; align-items: center; justify-content: center; height: 44px; cursor: pointer; font-weight: 800; font-size: 14px; }
.pay label + label { border-left: 1px solid #555; }
.pay input { position: absolute; opacity: 0; pointer-events: none; }
.pay input:checked + span { color: var(--ink); }
.pay label:has(input:checked) { background: var(--white); color: var(--ink); }
.sum__acts { display: grid; gap: 8px; margin-top: 14px; }
.sum__acts .btn--line { background: transparent; color: var(--white); border-color: #555; }
.sum__acts .btn--line:hover { background: var(--white); color: var(--ink); }

/* phone: sticky save bar at the bottom */
.savebar { display: none; }
@media (max-width: 979px) {
  .savebar {
    display: flex; align-items: center; gap: 12px;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--ink); color: var(--white);
    border-top: 3px solid var(--red);
  }
  .savebar div { flex: 1; min-width: 0; font-family: var(--mono); }
  .savebar small { display: block; font-size: 10px; color: #c9c9c4; text-transform: uppercase; letter-spacing: .06em; }
  .savebar b { font-size: 18px; }
  .savebar .btn { height: 46px; }
  .sum__save { display: none; }
}

/* toast */
.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); z-index: 100; display: none;
  padding: 12px 18px; background: var(--good); color: var(--white); font-weight: 800; box-shadow: 0 10px 24px rgba(0,0,0,.2); max-width: calc(100% - 32px); }
.toast.bad { background: var(--red); }
@media (min-width: 980px) { .toast { bottom: auto; top: 80px; left: auto; right: 24px; transform: none; } }

/* ---------- gate (landing + sign in) ---------- */
.gate { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--white); }
.gate__art { position: relative; isolation: isolate; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; gap: 40px;
  padding: clamp(24px, 5vw, 64px); background: var(--ink) url('../abc.jpeg') center/cover no-repeat; color: var(--white); }
.gate__art::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(14,14,14,.55), rgba(14,14,14,.92) 70%); }
.gate__brand { display: flex; align-items: center; gap: 12px; text-decoration: none; width: fit-content; }
.gate__brand img { width: 40px; height: 40px; background: var(--white); padding: 4px; }
.gate__brand b { font-size: 18px; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; }
.gate__copy h2 { margin: 0; font-size: clamp(34px, 5vw, 58px); font-weight: 900; line-height: .98; letter-spacing: -.02em; text-transform: uppercase; }
.gate__copy h2 i { font-style: normal; color: var(--red); }
.gate__copy p { margin: 14px 0 0; max-width: 40ch; color: #d4d4d0; font-size: 15px; }
.gate__form { display: flex; flex-direction: column; justify-content: center; padding: clamp(24px, 6vw, 72px); }
.gate__form h1 { margin: 0 0 6px; font-size: 32px; font-weight: 900; }
.gate__form h1::before { content: ""; display: block; width: 44px; height: 4px; background: var(--red); margin-bottom: 18px; }
.gate__form .sub { margin: 0 0 28px; color: var(--muted); }
.gate__form form { display: flex; flex-direction: column; gap: 18px; max-width: 380px; }
.gate__err { padding: 12px 14px; background: var(--red-soft); border-left: 4px solid var(--red); color: #a81a14; font-weight: 700; font-size: 14px; }
.gate__links { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.pw { position: relative; }
.pw .in { padding-right: 64px; }
.pw button { position: absolute; right: 6px; top: 6px; height: 36px; padding: 0 10px; border: 0; background: transparent; font: 700 12px var(--mono); color: var(--muted); cursor: pointer; }
.gate__foot { font-family: var(--mono); font-size: 11px; color: #9a9a95; }
.gate__foot a { color: #fff; }
@media (max-width: 860px) {
  .gate { grid-template-columns: 1fr; }
  .gate__art { min-height: 38vh; gap: 24px; }
}

/* landing CTA block */
.cta { display: flex; flex-direction: column; gap: 12px; max-width: 380px; }
.features { display: grid; gap: 2px; background: var(--rule); margin: 0 0 28px; max-width: 420px; }
.features div { background: var(--paper); padding: 12px 14px; border-left: 3px solid var(--red); }
.features b { display: block; font-size: 14px; }
.features span { font-size: 12.5px; color: var(--muted); }

/* ---------- receipt ---------- */
.receipt { max-width: 520px; margin: 0 auto; }
.receipt .panel { border-top-color: var(--red); }
.receipt .actions { display: grid; gap: 10px; margin-top: 18px; }
.seg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border: 1px solid var(--ink); }
.seg label { display: flex; align-items: center; justify-content: center; height: 46px; cursor: pointer; font-weight: 800; }
.seg label + label { border-left: 1px solid var(--ink); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: var(--ink); color: var(--white); }

/* ============================================================
   BILLING SCREEN (body.billing) - soft cards, dark summary panel
   ============================================================ */
body.billing {
  --bg: #F3F1EC; --card: #FFFFFF; --line: #E6E3DC; --soft: #F7F5F0;
  --r: #C8251C; --dark: #141414; --tx: #1B1B19; --mu: #8A877F;
  background: var(--bg); color: var(--tx);
}
.billing .mono { font-family: var(--mono); }
.billing .right { text-align: right; }
.billing .muted { color: var(--mu); font-size: 12px; }
.billing .muted b { color: var(--tx); }

/* top nav */
.billing .nav {
  position: sticky; top: 0; z-index: 50; height: 56px;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
  padding: 0 24px; background: var(--card); border-bottom: 1px solid var(--line);
}
.billing .nav__brand { display: flex; align-items: center; gap: 10px; text-decoration: none; min-width: 0; }
.billing .nav__logo { display: grid; place-items: center; width: 32px; height: 32px; background: #fff; border: 1px solid var(--line); border-radius: 8px; flex: none; }
.billing .nav__logo img { width: 22px; height: 22px; }
.billing .nav__brand b { display: block; font-size: 13px; font-weight: 800; line-height: 1.1; }
.billing .nav__brand small { display: block; font-size: 11px; color: var(--mu); }
.billing .nav__tabs { display: flex; gap: 4px; }
.billing .nav__tabs a { padding: 7px 14px; border-radius: 8px; font-size: 13px; font-weight: 600; color: #55534D; text-decoration: none; white-space: nowrap; }
.billing .nav__tabs a:hover { background: var(--soft); }
.billing .nav__tabs a.is-on { background: #F1E9DB; color: var(--tx); font-weight: 800; }
.billing .nav__user { display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.billing .chip { display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border: 1px solid var(--line); border-radius: 999px; }
.billing .chip__av { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--dark); color: #fff; font-size: 11px; font-weight: 800; }
.billing .chip b { display: block; font-size: 12px; line-height: 1.1; }
.billing .chip small { display: block; font-size: 10px; color: var(--mu); }
.billing .iconbtn { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 8px; color: var(--tx); background: var(--card); }
.billing .iconbtn:hover { background: var(--dark); color: #fff; }

/* page */
.billing .wrap { max-width: 1240px; margin: 0 auto; padding: 22px 24px 60px; }
.billing .phead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.billing .eyebrow { font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--mu); }
.billing .phead h1 { margin: 2px 0 0; font-size: 34px; font-weight: 800; letter-spacing: -.02em; line-height: 1.05; }
.billing .phead h1 i { font-style: normal; color: var(--r); }
.billing .phead__right { display: flex; align-items: flex-end; gap: 10px; }
.billing .ghost { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px; border: 1px solid var(--line); background: var(--card); border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; }
.billing .ghost:hover { border-color: var(--tx); }
.billing a.ghost { text-decoration: none; color: var(--tx); }

.billing .layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.billing .main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

/* cards + fields */
.billing .card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; overflow: hidden; }
.billing .card__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.billing .card__head h2 { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 14px; font-weight: 800; }
.billing .num { display: inline-grid; place-items: center; min-width: 26px; height: 20px; padding: 0 6px; border-radius: 4px; background: #FBE9E7; color: var(--r); font-family: var(--mono); font-size: 10.5px; font-weight: 700; }
.billing .pill { padding: 2px 9px; border-radius: 999px; background: var(--soft); border: 1px solid var(--line); font-family: var(--mono); font-size: 10.5px; font-weight: 600; color: var(--mu); }
.billing .fld { display: block; min-width: 0; }
.billing .fld > span { display: block; margin-bottom: 5px; font-size: 11.5px; color: var(--mu); }
.billing .ctl {
  width: 100%; height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--card); font-size: 13.5px; color: var(--tx);
}
.billing .ctl[readonly] { background: var(--soft); }
.billing .ctl:focus { outline: 2px solid var(--r); outline-offset: 0; border-color: var(--r); }
.billing select.ctl { appearance: none; padding-right: 28px;
  background-image: linear-gradient(45deg, transparent 50%, #777 50%), linear-gradient(135deg, #777 50%, transparent 50%);
  background-position: calc(100% - 15px) 16px, calc(100% - 10px) 16px; background-size: 5px 5px; background-repeat: no-repeat; }
.billing .row { display: grid; gap: 12px; align-items: end; }
.billing .row--cust { grid-template-columns: 1.2fr 1.4fr .5fr 1fr; }
.billing .row--add { grid-template-columns: 1.6fr .6fr .6fr .9fr auto; }
.billing .btn-add { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; padding: 0 16px; border: 0; border-radius: 8px; background: var(--dark); color: #fff; font-size: 13px; font-weight: 700; cursor: pointer; }
.billing .btn-add:disabled { background: #B9B6AE; cursor: not-allowed; }
.billing .btn-add:not(:disabled):hover { background: var(--r); }

/* items table */
.billing .tbl { width: 100%; border-collapse: collapse; font-size: 13px; font-family: var(--display); }
.billing .tbl th { position: static; padding: 8px 10px; border: 0; border-bottom: 1px solid var(--line); background: var(--soft); font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--mu); text-align: left; }
.billing .tbl th.r, .billing .tbl td.r { text-align: right; font-family: var(--mono); }
.billing .tbl td { padding: 11px 10px; border-bottom: 1px solid #F0EEE8; }
.billing .tbl .c-no { width: 44px; font-family: var(--mono); font-size: 11px; color: var(--mu); }
.billing .tbl .c-prod { font-weight: 700; }
.billing .tbl .c-amt { font-weight: 700; }
.billing .tbl .c-amt.neg { color: var(--r); }
.billing .tbl .c-del { width: 40px; text-align: right; }
.billing .tbl .del { display: inline-grid; place-items: center; width: 28px; height: 28px; border: 0; background: transparent; color: #B0ADA4; cursor: pointer; border-radius: 6px; }
.billing .tbl .del:hover { color: var(--r); background: #FBE9E7; }
.billing .empty { padding: 30px 12px; text-align: center; color: var(--mu); font-size: 13px; border: 1px dashed var(--line); border-radius: 8px; }
.billing .tfoot { display: flex; align-items: flex-end; gap: 28px; margin: 0 -18px -16px; padding: 14px 28px; background: var(--soft); border-top: 1px solid var(--line); }
.billing .tfoot > div > span { display: block; font-family: var(--mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--mu); }
.billing .tfoot b { font-size: 18px; font-weight: 800; font-family: var(--mono); }
.billing .tfoot__net { margin-left: auto; text-align: right; }
.billing .tfoot__net b { font-size: 24px; }

/* dark summary */
.billing .sum2 { position: sticky; top: 76px; background: var(--dark); color: #fff; border-radius: 14px; padding: 20px; box-shadow: 0 18px 40px rgba(0,0,0,.18); }
.billing .sum2__eyebrow { display: flex; align-items: center; justify-content: space-between; font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: #9C998F; }
.billing .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--r); }
.billing .sum2__cust { margin-top: 10px; font-size: 20px; font-weight: 800; line-height: 1.15; }
.billing .sum2__meta { margin-top: 3px; font-family: var(--mono); font-size: 11px; color: #9C998F; }
.billing .sum2__rows { margin-top: 16px; border-top: 1px solid #2c2c29; }
.billing .sum2__rows div { display: flex; justify-content: space-between; align-items: baseline; padding: 11px 0; border-bottom: 1px solid #2c2c29; font-size: 13px; color: #BDBAB0; }
.billing .sum2__rows b { color: #fff; font-family: var(--mono); font-size: 13.5px; }
.billing .sum2__rows .is-bill span { color: #E9A29C; }
.billing .sum2__total { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 0 6px; }
.billing .sum2__total span { font-size: 13px; font-weight: 800; }
.billing .sum2__total b { font-family: var(--mono); font-size: 26px; font-weight: 700; }
.billing .sum2__lbl { display: block; margin: 16px 0 6px; font-size: 11.5px; color: #9C998F; }
.billing .sum2__paid { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 12px; background: #1E1E1C; border: 1px solid #34342f; border-radius: 8px; }
.billing .sum2__paid:focus-within { border-color: var(--r); }
.billing .sum2__paid span { color: #9C998F; }
.billing .sum2__paid input { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; text-align: right; color: #fff; font-family: var(--mono); font-size: 18px; }
.billing .sum2__quick { display: flex; gap: 6px; margin-top: 8px; }
.billing .sum2__quick button { padding: 4px 10px; border: 1px solid #3c3c37; border-radius: 6px; background: transparent; color: #E9E6DC; font-size: 11.5px; font-weight: 600; cursor: pointer; }
.billing .sum2__quick button:hover { background: #fff; color: var(--dark); }
.billing .sum2__bal { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; padding: 12px 14px; background: #1E1E1C; border-radius: 8px; font-size: 13px; color: #BDBAB0; }
.billing .sum2__bal b { font-family: var(--mono); font-size: 18px; color: #fff; }
.billing .sum2__bal.is-clear b { color: #6fd39b; }
.billing .sum2__mode { display: grid; grid-template-columns: 1fr 1fr; padding: 3px; background: #1E1E1C; border-radius: 8px; }
.billing .sum2__mode label { position: relative; display: flex; align-items: center; justify-content: center; gap: 7px; height: 36px; border-radius: 6px; font-size: 13px; font-weight: 700; color: #BDBAB0; cursor: pointer; }
.billing .sum2__mode input { position: absolute; opacity: 0; pointer-events: none; }
.billing .sum2__mode label:has(input:checked) { background: #F4EFE4; color: var(--dark); }
.billing .sum2__save { display: block; width: 100%; margin-top: 22px; height: 46px; border: 0; border-radius: 9px; background: var(--r); color: #fff; font-size: 14px; font-weight: 800; cursor: pointer; }
.billing .sum2__save:hover { background: #a91e17; }
.billing .sum2__acts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.billing .sum2__acts a { display: flex; align-items: center; justify-content: center; gap: 6px; height: 38px; border: 1px solid #3c3c37; border-radius: 8px; color: #E9E6DC; font-size: 12.5px; font-weight: 600; text-decoration: none; }
.billing .sum2__acts a:hover { background: #fff; color: var(--dark); }

.billing .savebar2 { display: none; }
.billing .toast { background: #1f7a4d; border-radius: 8px; }
.billing .toast.bad { background: var(--r); }

/* tablet / phone */
@media (max-width: 980px) {
  .billing .nav { grid-template-columns: 1fr auto; height: auto; padding: 8px 14px; row-gap: 6px; }
  .billing .nav__tabs { grid-column: 1 / -1; grid-row: 2; overflow-x: auto; }
  .billing .chip small { display: none; }
  .billing .wrap { padding: 16px 14px 110px; }
  .billing .phead { flex-direction: column; align-items: stretch; }
  .billing .phead h1 { font-size: 28px; }
  .billing .phead__right { justify-content: space-between; }
  .billing .phead__right .fld { flex: 1; }
  .billing .layout { grid-template-columns: 1fr; }
  .billing .sum2 { position: static; }
  .billing .row--cust { grid-template-columns: 1fr 1fr; }
  .billing .row--cust .fld:nth-child(1), .billing .row--cust .fld:nth-child(2) { grid-column: 1 / -1; }
  .billing .row--add { grid-template-columns: 1fr 1fr; }
  .billing .row--add .fld:nth-child(1), .billing .row--add .fld:nth-child(4) { grid-column: 1 / -1; }
  .billing .btn-add { grid-column: 1 / -1; height: 46px; }

  .billing .tbl thead { display: none; }
  .billing .tbl, .billing .tbl tbody { display: block; }
  .billing .tbl tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 10px; padding: 12px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 10px; }
  .billing .tbl td { display: flex; flex-direction: column; gap: 2px; padding: 0; border: 0; text-align: left !important; }
  .billing .tbl td[hidden] { display: none; }
  .billing .tbl td::before { content: attr(data-label); font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--mu); }
  .billing .tbl td.c-no { display: none; }
  .billing .tbl td.c-prod { grid-column: 1 / -1; font-size: 15px; }
  .billing .tbl td.c-prod::before, .billing .tbl td.c-del::before { display: none; }
  .billing .tbl td.c-del { grid-column: 1 / -1; align-items: flex-end; }
  .billing .tfoot { margin: 0; border-radius: 8px; padding: 12px 14px; gap: 18px; border: 1px solid var(--line); }

  .billing .savebar2 {
    display: flex; align-items: center; gap: 12px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); background: var(--dark); color: #fff; border-top: 1px solid #2c2c29;
  }
  .billing .savebar2 div { flex: 1; min-width: 0; font-family: var(--mono); }
  .billing .savebar2 small { display: block; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: #9C998F; }
  .billing .savebar2 b { font-size: 19px; }
  .billing .savebar2 button { height: 44px; padding: 0 22px; border: 0; border-radius: 9px; background: var(--r); color: #fff; font-size: 14px; font-weight: 800; cursor: pointer; }
  .billing .sum2__save { display: none; }
  .billing .toast { bottom: 84px; }
}

/* ============================================================
   CASH RECEIPT (body.receipt-pg) - builds on the billing styles
   ============================================================ */
.receipt-pg .row--rcust { grid-template-columns: 1.3fr 1.5fr 1fr; }
.receipt-pg .card--pay { display: flex; flex-direction: column; gap: 16px; }
.receipt-pg .card--pay .card__head { margin-bottom: 0; }

.receipt-pg .amt { display: flex; align-items: center; gap: 12px; height: 72px; padding: 0 18px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.receipt-pg .amt:focus-within { border-color: var(--r); outline: 2px solid var(--r); outline-offset: 0; }
.receipt-pg .amt i { font-style: normal; font-size: 26px; color: var(--mu); }
.receipt-pg .amt input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; font-family: var(--mono); font-size: 34px; font-weight: 700; color: var(--tx); }
.receipt-pg .amt input::placeholder { color: #C9C6BD; }

.receipt-pg .chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: -4px; }
.receipt-pg .chips button { padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); font-family: var(--mono); font-size: 12px; font-weight: 600; cursor: pointer; color: var(--tx); }
.receipt-pg .chips button:hover { border-color: var(--tx); background: var(--soft); }
.receipt-pg .chips button[hidden] { display: none; }

.receipt-pg .mode { display: grid; grid-template-columns: 1fr 1fr; padding: 3px; background: var(--soft); border: 1px solid var(--line); border-radius: 9px; }
.receipt-pg .mode label { position: relative; display: flex; align-items: center; justify-content: center; gap: 7px; height: 40px; border-radius: 7px; font-size: 13.5px; font-weight: 700; color: #6d6a62; cursor: pointer; }
.receipt-pg .mode input { position: absolute; opacity: 0; pointer-events: none; }
.receipt-pg .mode label:has(input:checked) { background: var(--card); color: var(--tx); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

.receipt-pg .payfoot { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--line); }
.receipt-pg .btn-save { height: 42px; padding: 0 20px; border: 0; border-radius: 8px; background: var(--r); color: #fff; font-size: 14px; font-weight: 800; cursor: pointer; }
.receipt-pg .btn-save:hover { background: #a91e17; }
.receipt-pg .payfoot .ghost { height: 42px; }

/* live preview */
.receipt-pg .prev { position: sticky; top: 76px; background: var(--dark); color: #fff; border-radius: 14px; padding: 18px; box-shadow: 0 18px 40px rgba(0,0,0,.18); }
.receipt-pg .prev__top { display: flex; justify-content: space-between; margin-bottom: 14px; font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: #9C998F; }
.receipt-pg .paper { background: #FBF8F0; color: #1B1B19; padding: 18px 18px 14px; border-radius: 4px; font-family: var(--mono); font-size: 11.5px; }
.receipt-pg .paper__head { display: flex; flex-direction: column; align-items: center; gap: 4px; padding-bottom: 12px; border-bottom: 1px dashed #cfc9b9; text-align: center; }
.receipt-pg .paper__head b { font-family: var(--display); font-size: 13px; letter-spacing: .06em; }
.receipt-pg .paper__head small { font-size: 10px; color: #8a877f; }
.receipt-pg .paper__rows { margin: 0; padding: 10px 0; border-bottom: 1px dashed #cfc9b9; }
.receipt-pg .paper__rows--last { border-bottom: 0; }
.receipt-pg .paper__rows div { display: flex; justify-content: space-between; gap: 12px; padding: 2px 0; }
.receipt-pg .paper__rows dt { color: #6d6a62; }
.receipt-pg .paper__rows dd { margin: 0; text-align: right; word-break: break-word; }
.receipt-pg .paper__recv { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 0; border-bottom: 2px solid #1B1B19; }
.receipt-pg .paper__recv span { font-weight: 700; letter-spacing: .06em; }
.receipt-pg .paper__recv b { font-size: 22px; }
.receipt-pg .paper__thanks { margin: 8px 0 0; text-align: center; font-size: 10px; color: #8a877f; }
.receipt-pg .prev__rows { margin-top: 16px; }
.receipt-pg .prev__rows div { display: flex; justify-content: space-between; align-items: baseline; padding: 9px 0; font-size: 13px; color: #BDBAB0; border-top: 1px solid #2c2c29; }
.receipt-pg .prev__rows b { font-family: var(--mono); color: #fff; font-size: 13.5px; }
.receipt-pg .prev__bal { display: flex; justify-content: space-between; align-items: baseline; padding-top: 12px; border-top: 1px solid #2c2c29; }
.receipt-pg .prev__bal span { font-size: 13px; font-weight: 800; }
.receipt-pg .prev__bal b { font-family: var(--mono); font-size: 26px; }

@media (max-width: 980px) {
  .receipt-pg .row--rcust { grid-template-columns: 1fr 1fr; }
  .receipt-pg .row--rcust .fld { grid-column: 1 / -1; }
  .receipt-pg .prev { position: static; }
  .receipt-pg .amt { height: 64px; }
  .receipt-pg .amt input { font-size: 28px; }
  .receipt-pg .payfoot { display: none; }
}

/* ============================================================
   Rebuild additions: history, statement, day summary, owner pages, printable bill.
   Same billing look: warm paper, white cards, dark ink, one red for money owed.
   ============================================================ */
.billing .notice { margin: 0 0 14px; padding: 12px 16px; border-radius: 10px; border-left: 4px solid var(--dark); background: var(--card); font-weight: 600; font-size: 14px; }
.billing .notice.bad { border-left-color: var(--r); background: #FBEAE8; color: #8F1A14; }
.billing .notice a { color: inherit; }
.billing .fkpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.billing .fkpi { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; min-width: 0; }
.billing .fkpi span { display: block; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--mu); }
.billing .fkpi b { display: block; margin-top: 4px; font: 800 24px var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.billing .fkpi small { color: var(--mu); font-size: 12px; }
.billing .fkpi.is-dark { background: var(--dark); border-color: var(--dark); color: #fff; }
.billing .fkpi.is-dark span, .billing .fkpi.is-dark small { color: #B8B5AD; }
.billing .fkpi.is-red b { color: var(--r); }
.billing .ffilters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: 10px; align-items: end; }
.billing .tbl a { color: inherit; font-weight: 700; }
.billing .tbl tr.is-day td { background: var(--soft); font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--mu); padding: 7px 10px; }
.billing .tbl tr.is-total td { border-top: 2px solid var(--dark); font-weight: 800; background: var(--soft); }
.billing .tbl td.due, .billing .due { color: var(--r); font-weight: 800; }
.billing .tbl td.got { color: #1f7a4d; font-weight: 700; }
.billing .tag { display: inline-block; padding: 2px 9px; border-radius: 999px; background: var(--soft); border: 1px solid var(--line); font-size: 11px; font-weight: 700; }
.billing .tag.r { background: #FBEAE8; border-color: #F2C9C5; color: var(--r); }
.billing .btn-sm2 { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--tx); font-weight: 700; font-size: 12px; text-decoration: none; cursor: pointer; }
.billing .btn-sm2.dark { background: var(--dark); border-color: var(--dark); color: #fff; }
.billing .btn-sm2.red { background: var(--r); border-color: var(--r); color: #fff; }
.billing .stack2 { display: flex; flex-direction: column; gap: 16px; }
.billing .owner-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.billing .owner-grid a { display: block; padding: 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); text-decoration: none; color: var(--tx); }
.billing .owner-grid a b { display: block; font-size: 15px; } .billing .owner-grid a small { color: var(--mu); }
.billing .owner-grid a:hover { border-color: var(--dark); }
.billing input.ctl.sm { height: 34px; padding: 0 8px; font-size: 13px; }

/* printable bill / statement (80 mm-friendly on phones, A5-ish on desktop) */
.billing .billp { max-width: 520px; margin: 0 auto; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 22px 22px 16px; font-family: var(--display); }
.billing .billp__head { text-align: center; padding-bottom: 12px; border-bottom: 2px dashed var(--line); }
.billing .billp__head img { width: 36px; height: 36px; }
.billing .billp__head b { display: block; font-size: 18px; font-weight: 900; letter-spacing: .04em; }
.billing .billp__head small { color: var(--mu); font-size: 12px; }
.billing .billp dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 12px 0; font-size: 13px; }
.billing .billp dt { color: var(--mu); } .billing .billp dd { margin: 0; text-align: right; font-family: var(--mono); font-weight: 600; }
.billing .billp table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin: 6px 0; }
.billing .billp th { text-align: left; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--mu); border-bottom: 1px solid var(--line); padding: 6px 4px; }
.billing .billp td { padding: 7px 4px; border-bottom: 1px dotted var(--line); }
.billing .billp .r { text-align: right; font-family: var(--mono); }
.billing .billp__tot { border-top: 2px dashed var(--line); margin-top: 6px; padding-top: 8px; }
.billing .billp__tot div { display: flex; justify-content: space-between; padding: 3px 0; font-size: 13.5px; }
.billing .billp__tot div.big { font-size: 17px; font-weight: 900; }
.billing .billp__tot div.due b { color: var(--r); }
.billing .billp__thanks { text-align: center; color: var(--mu); font-size: 12px; margin: 12px 0 0; }
.billing .billbar { max-width: 520px; margin: 0 auto 12px; display: flex; gap: 8px; flex-wrap: wrap; justify-content: space-between; }
@media (max-width: 900px) {
  .billing .fkpis, .billing .owner-grid { grid-template-columns: 1fr 1fr; }
  .billing .ffilters { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) { .billing .tbl.resp thead { display: none; } .billing .tbl.resp tr { display: block; padding: 8px 0; border-bottom: 1px solid var(--line); }
  .billing .tbl.resp td { display: flex; justify-content: space-between; gap: 10px; border: 0; padding: 3px 10px; text-align: right; }
  .billing .tbl.resp td::before { content: attr(data-label); color: var(--mu); font-size: 11px; font-weight: 700; text-align: left; }
  .billing .tbl.resp tr.is-day td::before, .billing .tbl.resp tr.is-total td::before { content: none; } }
@media print {
  .billing .nav, .billing .billbar, .billing .no-print, .billing .savebar2 { display: none !important; }
  body.billing { background: #fff !important; }
  .billing .billp { border: 0; max-width: none; padding: 0; }
  .billing .card { border: 0; padding: 0; }
}

/* bill and receipt slips on a thermal roll: no page margins (so no browser date/title lines),
   the slip fills the paper width, bigger type, and everything solid black (grey and red print faint) */
@media print {
  body.slip-pg, body.slip-pg .wrap { margin: 0 !important; padding: 0 !important; max-width: none !important; width: auto !important; background: #fff !important; }
  .slip-pg .nav, .slip-pg .billbar, .slip-pg .notice, .slip-pg .dock { display: none !important; }
  .slip-pg .billp { width: 100%; max-width: none; margin: 0; padding: 3mm 3mm 8mm; border: 0; border-radius: 0; box-shadow: none;
    font-family: Arial, Helvetica, sans-serif; color: #000; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .slip-pg .billp * { color: #000 !important; }
  .slip-pg .billp__head { padding-bottom: 8px; border-bottom: 2px dashed #000; }
  .slip-pg .billp__head img { width: 44px; height: 44px; }
  .slip-pg .billp__head b { font-size: 22px; }
  .slip-pg .billp__head small { font-size: 14px; font-weight: 700; }
  .slip-pg .billp dl { font-size: 15px; font-weight: 600; gap: 3px 10px; margin: 8px 0; }
  .slip-pg .billp dd { font-family: Arial, Helvetica, sans-serif; font-weight: 700; }
  .slip-pg .billp table { font-size: 14.5px; margin: 4px 0; }
  .slip-pg .billp th { font-size: 12px; font-weight: 800; padding: 4px 2px; border-bottom: 2px solid #000; }
  .slip-pg .billp td { padding: 5px 2px; border-bottom: 1px dashed #000; font-weight: 600; vertical-align: top; }
  .slip-pg .billp .r { font-family: Arial, Helvetica, sans-serif; white-space: nowrap; }
  .slip-pg .billp__tot { border-top: 2px dashed #000; padding-top: 6px; }
  .slip-pg .billp__tot div { font-size: 16px; font-weight: 700; padding: 2px 0; }
  .slip-pg .billp__tot div.big { font-size: 20px; font-weight: 900; }
  .slip-pg .billp__thanks { font-size: 14px; font-weight: 700; margin-top: 10px; }
}
