/* BillGrid — clean black & white base, brand-blue accent (#1877F2 default). */
:root { --brand: #1877F2; --ink: #111; --muted: #6b7280; --line: #e5e7eb; --bg: #f7f7f8; --err: #b91c1c; --ok: #15803d; }
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; margin: 0 0 14px; } h2 { font-size: 18px; margin: 26px 0 10px; } h3 { margin: 14px 0 8px; }
.muted { color: var(--muted); font-size: 14px; }
.mono { font-family: ui-monospace, Menlo, monospace; font-size: 12px; word-break: break-all; }
.num { text-align: right; }

/* Admin chrome */
.topbar { background: #fff; border-bottom: 1px solid var(--line); }
.topbar-inner { max-width: 1080px; margin: 0 auto; padding: 10px 18px; display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 18px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brandlogo { height: 30px; width: 30px; border-radius: 50%; object-fit: cover; }
.topbar nav { display: flex; gap: 16px; flex: 1; }
.topbar nav a { color: var(--ink); font-size: 15px; padding: 4px 2px; }
.topbar nav a.active { color: var(--brand); font-weight: 600; border-bottom: 2px solid var(--brand); }
.logout { margin: 0; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 24px 18px 40px; }
.wrap.narrow { max-width: 460px; padding-top: 56px; }
.foot { text-align: center; color: var(--muted); font-size: 13px; padding: 18px; }
.pagehead { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pagehead h1 { margin: 0; }

/* Login branding */
.loginbrand { text-align: center; margin-bottom: 18px; }
.loginlogo { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; }
.wordmark { font-size: 34px; font-weight: 800; letter-spacing: -0.5px; color: var(--ink); }
.productname { font-size: 16px; color: var(--brand); font-weight: 600; letter-spacing: 2px; text-transform: uppercase; }

/* Cards / tables / badges */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin: 18px 0 6px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.card-label { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 0.4px; }
.card-value { font-size: 26px; font-weight: 700; margin-top: 4px; }
.card-sub { color: var(--muted); font-size: 13px; }
.card-alert .card-value { color: var(--err); }
.tbl { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.tbl th, .tbl td { padding: 9px 11px; border-bottom: 1px solid var(--line); text-align: left; font-size: 14px; vertical-align: top; }
.tbl th { background: #fafafa; font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--muted); }
.tbl tr:last-child td { border-bottom: none; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #e5e7eb; color: #374151; }
.badge-paid { background: #dcfce7; color: #166534; }
.badge-sent { background: #dbeafe; color: #1e40af; }
.badge-overdue { background: #fee2e2; color: #991b1b; }
.badge-draft { background: #e5e7eb; color: #374151; }
.badge-cancelled { background: #f3f4f6; color: #9ca3af; }
.badge-test { background: #fef3c7; color: #92400e; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 14px 0; }
.tabs a { padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); background: #fff; font-size: 14px; }
.tabs a.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 18px; margin: 14px 0; }
.panel summary { cursor: pointer; font-weight: 600; }

/* Forms / buttons */
.form label { display: block; font-size: 14px; font-weight: 600; margin: 12px 0 0; }
.form input, .form select, .form textarea { display: block; width: 100%; margin-top: 5px; padding: 9px 10px; border: 1px solid #d1d5db; border-radius: 7px; font-size: 15px; font-weight: 400; background: #fff; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }
.formactions { display: flex; gap: 10px; margin-top: 20px; }
.btn { display: inline-block; background: var(--brand); color: #fff; border: 1px solid var(--brand); padding: 9px 16px; border-radius: 7px; font-size: 15px; font-weight: 600; cursor: pointer; }
.btn:hover { text-decoration: none; filter: brightness(1.07); }
.btn-small { padding: 6px 12px; font-size: 14px; }
.btn-ghost { background: #fff; color: var(--ink); border-color: #d1d5db; }
.linkbtn { background: none; border: none; padding: 0; color: var(--brand); font-size: 14px; cursor: pointer; }
.linkbtn.danger { color: var(--err); }
form.inline { display: inline; }
.filters { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; margin: 10px 0 14px; }
.filters input, .filters select { padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 7px; font-size: 14px; }
.filters label { font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.flash { padding: 11px 14px; border-radius: 8px; margin: 12px 0; font-size: 14px; }
.flash-ok { background: #dcfce7; color: #166534; }
.flash-err { background: #fee2e2; color: #991b1b; }
table.items td.w-qty { width: 90px; } table.items td.w-price { width: 130px; }

/* Public pay pages */
.paybody { background: #f4f5f7; }
.paywrap { max-width: 560px; margin: 34px auto; padding: 0 14px; }
.paycard { background: #fff; border-radius: 12px; padding: 26px; box-shadow: 0 2px 14px rgba(0,0,0,0.07); }
.payhead { display: flex; align-items: center; gap: 12px; border-bottom: 3px solid var(--brand); padding-bottom: 14px; margin-bottom: 18px; }
.pay-logo { height: 44px; width: 44px; border-radius: 50%; object-fit: cover; }
.paybiz { font-size: 20px; font-weight: 700; }
.paytotals { margin: 16px 0; }
.paytotals > div { display: flex; justify-content: space-between; padding: 5px 0; font-size: 15px; }
.paytotal { border-top: 2px solid var(--ink); margin-top: 6px; padding-top: 10px !important; font-size: 19px !important; font-weight: 700; }
.paybtn { display: block; width: 100%; text-align: center; background: var(--brand); font-size: 17px; padding: 13px; margin-top: 10px; }
.payfoot { text-align: center; color: var(--muted); font-size: 12.5px; margin-top: 14px; }
.paystatus { width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 800; margin: 4px auto 14px; }
.paystatus.ok { background: #dcfce7; color: #166534; }
.paystatus.warn { background: #fef3c7; color: #92400e; }
.paycard h1 { text-align: center; }
.paycard .payhead + h1, .paycard h1:first-of-type { text-align: left; }
.paystatus + h1 { text-align: center !important; }
