/* Housepass app UI: dashboard, login, staff counter, customer card and join.
   Merchant-facing screens wear the Housepass brand; customer-facing screens
   (card, join) are re-coloured per shop through --shop-* variables.
   @author Thomas G. and Sophia, SOPHIA XT LLC (sophiaxt.com) */

@import url("https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,500;12..96,700;12..96,800&family=JetBrains+Mono:wght@400;600&display=swap");

:root {
  --ink: #0f1a16; --ink-2: #17251f; --ink-3: #22332b; --line: #2e4238;
  --paper: #f4efe4; --paper-2: #e9e2d3; --muted: #93a39a;
  --brass: #d9a441; --hot: #e4572e; --ok: #5fbf8a;
  --r: 4px;
  --display: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --text: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--ink); color: var(--paper); font: 15px/1.5 var(--text); -webkit-font-smoothing: antialiased; }
a { color: var(--brass); }
h1, h2, h3 { font-family: var(--display); font-weight: 800; letter-spacing: -0.02em; margin: 0 0 .4em; line-height: 1.05; }
h1 { font-size: clamp(28px, 4vw, 44px); } h2 { font-size: 22px; } h3 { font-size: 16px; font-weight: 700; }
.mono, .money { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* controls */
button, .btn { font: 600 14px var(--text); border: 1px solid var(--line); background: var(--ink-3); color: var(--paper);
  padding: 10px 16px; border-radius: var(--r); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
button:hover, .btn:hover { border-color: var(--brass); }
.primary { background: var(--brass); color: var(--ink); border-color: var(--brass); }
.primary:hover { background: #e6b556; }
.danger { color: var(--hot); }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { font: 15px var(--text); width: 100%; padding: 11px 12px; border-radius: var(--r);
  border: 1px solid var(--line); background: var(--ink-2); color: var(--paper); }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--brass); outline-offset: 1px; }
label { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 14px 0 6px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.panel { background: var(--ink-2); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; }
.tag { font: 600 11px var(--mono); text-transform: uppercase; letter-spacing: .08em; padding: 3px 7px; border: 1px solid var(--line);
  clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px); }
.dot { width: 8px; height: 8px; display: inline-block; background: var(--muted); }
.dot.on { background: var(--ok); } .dot.off { background: var(--hot); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font: 600 11px var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 8px; border-bottom: 1px solid var(--line); }
td { padding: 10px 8px; border-bottom: 1px solid var(--ink-3); }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--ink-3); }
.pos { color: var(--ok); } .neg { color: var(--hot); }
code, pre { font-family: var(--mono); font-size: 13px; }
pre { background: #0a120f; border: 1px solid var(--line); padding: 14px; overflow: auto; border-radius: var(--r); }

/* toast */
#toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; transition: .25s;
  background: var(--paper); color: var(--ink); padding: 12px 18px; font-weight: 700; border-radius: var(--r); z-index: 99; max-width: 90vw; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.bad { background: var(--hot); color: #fff; }

/* wordmark */
.wordmark { display: inline-flex; align-items: center; gap: 10px; font: 800 20px var(--display); letter-spacing: -0.03em; color: var(--paper); text-decoration: none; }
.wordmark svg { width: 26px; height: 26px; }

/* ---- auth ---- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-art { background: var(--ink-2); position: relative; overflow: hidden; padding: 40px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-form form { width: 100%; max-width: 380px; }
.stack-cards { position: relative; height: 340px; }
.mini-card { position: absolute; width: 300px; height: 186px; border-radius: 12px; padding: 18px; color: #fff;
  box-shadow: 0 30px 60px rgba(0,0,0,.45); display: flex; flex-direction: column; justify-content: space-between; transition: transform .6s cubic-bezier(.2,.8,.2,1); }
.mini-card b { font: 800 18px var(--display); } .mini-card .money { font-size: 26px; font-weight: 600; }
.auth-art:hover .mini-card:nth-child(1) { transform: translate(-10px,-14px) rotate(-10deg); }
.auth-art:hover .mini-card:nth-child(3) { transform: translate(40px, 30px) rotate(9deg); }
@media (max-width: 860px) { .auth { grid-template-columns: 1fr; } .auth-art { display: none; } }

/* ---- dashboard ---- */
.dash { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { background: #0a120f; border-right: 1px solid var(--line); padding: 20px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; }
.side .wordmark { margin: 0 6px 22px; }
.side a.nav { color: var(--muted); text-decoration: none; padding: 9px 10px; border-radius: var(--r); font-weight: 600; display: flex; gap: 10px; align-items: center; }
.side a.nav:hover { color: var(--paper); background: var(--ink-2); }
.side a.nav.active { color: var(--ink); background: var(--brass); }
.side .foot { margin-top: auto; font-size: 13px; }
main.view { padding: 28px clamp(16px, 3vw, 40px) 80px; max-width: 1200px; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 18px 0; }
.kpi { background: var(--ink-2); border: 1px solid var(--line); padding: 16px; border-radius: var(--r); }
.kpi .label { font: 600 11px var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.kpi .value { font: 600 28px var(--mono); margin-top: 6px; }
.kpi.gold .value { color: var(--brass); }
.bars { display: flex; flex-direction: column; gap: 8px; }
.bar { display: grid; grid-template-columns: 90px 1fr 40px; gap: 10px; align-items: center; font-size: 13px; }
.bar i { display: block; height: 10px; background: var(--brass); min-width: 2px; }
.split { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; }
.tier-row { display: grid; grid-template-columns: 1.2fr repeat(4, 1fr) 36px; gap: 8px; align-items: end; margin-bottom: 8px; }
.bonus-row { display: grid; grid-template-columns: 1fr 1fr 36px; gap: 8px; margin-bottom: 8px; }
.mobile-top { display: none; }
@media (max-width: 900px) {
  .dash { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 240px; z-index: 50; transform: translateX(-100%); transition: .25s; }
  .side.open { transform: none; }
  .mobile-top { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
  .kpis { grid-template-columns: 1fr 1fr; } .split, .grid2 { grid-template-columns: 1fr; }
  .tier-row { grid-template-columns: 1fr 1fr 1fr; }
}

/* ---- branded card (customer side + previews) ---- */
.shop { --shop-bg: #1d2a24; --shop-fg: #f4efe4; --shop-accent: #d9a441; }
.pass { background: var(--shop-bg); color: var(--shop-fg); border-radius: 16px; padding: 22px; position: relative; overflow: hidden;
  box-shadow: 0 40px 80px rgba(0,0,0,.35), inset 0 0 0 1px rgba(255,255,255,.06); }
.pass::after { content: ""; position: absolute; inset: 0; background: linear-gradient(120deg, transparent 40%, rgba(255,255,255,.08) 50%, transparent 60%);
  transform: translateX(-100%); animation: sheen 5s ease-in-out infinite; pointer-events: none; }
@keyframes sheen { 60%, 100% { transform: translateX(100%); } }
.pass .top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.pass .logo { width: 44px; height: 44px; border-radius: 8px; object-fit: contain; background: rgba(255,255,255,.08); }
.pass .mark { width: 44px; height: 44px; border-radius: 8px; display: grid; place-items: center; font: 800 22px var(--display); background: var(--shop-accent); color: var(--shop-bg); }
.pass .shopname { font: 800 20px var(--display); letter-spacing: -0.02em; flex: 1; }
.pass .tier { font: 600 11px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--shop-accent); border: 1px solid currentColor; padding: 4px 8px; }
.pass .lbl { font: 600 11px var(--mono); letter-spacing: .1em; text-transform: uppercase; opacity: .7; margin-top: 22px; }
.pass .bal { font: 600 48px var(--mono); letter-spacing: -0.03em; line-height: 1.1; }
.pass .sub { display: flex; gap: 18px; font: 13px var(--mono); opacity: .85; }
.progress { height: 6px; background: rgba(255,255,255,.12); margin-top: 18px; }
.progress i { display: block; height: 100%; background: var(--shop-accent); width: 0; transition: width 1s cubic-bezier(.2,.8,.2,1); }
@media (prefers-reduced-motion: reduce) { .pass::after { animation: none; } * { transition: none !important; } }

/* customer pages are light, re-coloured by the shop */
body.customer { background: var(--paper); color: var(--ink); }
body.customer .panel { background: #fff; border-color: var(--paper-2); }
body.customer input, body.customer select { background: #fff; color: var(--ink); border-color: #d8cfbd; }
body.customer button { background: #fff; color: var(--ink); border-color: #d8cfbd; }
body.customer .primary { background: var(--shop-bg); color: var(--shop-fg); border-color: var(--shop-bg); }
body.customer label { color: #6b746f; }
body.customer .muted { color: #6b746f; }
.wrap { max-width: 460px; margin: 0 auto; padding: 22px 16px 60px; }
.qr { background: #fff; padding: 14px; border-radius: 12px; display: grid; place-items: center; margin: 16px 0; border: 1px solid var(--paper-2); }
.qr img { width: 210px; height: 210px; image-rendering: pixelated; }
.qr .mono { font-size: 13px; letter-spacing: .12em; margin-top: 6px; color: var(--ink); }
.presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.presets button { flex-direction: column; padding: 12px 6px; gap: 2px; }
.presets button small { color: var(--ok); font: 600 11px var(--mono); }
body.customer .presets button small { color: #2f8a57; }
.walletbtns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.walletbtns .btn { justify-content: center; background: #000; color: #fff; border-color: #000; }
.act { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--paper-2); font-size: 14px; }
.perks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; }
.perk { background: #fff; border: 1px solid var(--paper-2); padding: 12px; border-radius: 8px; text-align: center; }
.perk b { display: block; font: 600 20px var(--mono); color: var(--ink); }
.perk span { font-size: 12px; color: #6b746f; }
.powered { text-align: center; font-size: 11px; color: #a8a090; margin-top: 30px; }

/* ---- staff counter ---- */
body.counter { background: #0a120f; }
.counter-wrap { max-width: 520px; margin: 0 auto; padding: 14px; }
.pinpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 18px; }
.pinpad button, .keypad button { font: 600 24px var(--mono); padding: 18px 0; justify-content: center; }
.pindots { display: flex; gap: 12px; justify-content: center; margin: 18px 0; }
.pindots i { width: 14px; height: 14px; border: 2px solid var(--brass); }
.pindots i.f { background: var(--brass); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.amount { font: 600 52px var(--mono); text-align: center; margin: 10px 0 14px; letter-spacing: -0.03em; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.actions button { justify-content: center; padding: 16px 8px; font-size: 15px; }
.scanbox { position: relative; aspect-ratio: 1; background: #000; border: 1px solid var(--line); overflow: hidden; border-radius: var(--r); }
.scanbox video { width: 100%; height: 100%; object-fit: cover; }
.scanbox::after { content: ""; position: absolute; inset: 18%; border: 2px solid var(--brass);
  clip-path: polygon(0 0, 20% 0, 20% 3px, 3px 3px, 3px 20%, 0 20%, 0 80%, 3px 80%, 3px calc(100% - 3px), 20% calc(100% - 3px), 20% 100%, 0 100%, 0 0, 100% 0, 100% 20%, calc(100% - 3px) 20%, calc(100% - 3px) 3px, 80% 3px, 80% 0, 100% 0, 100% 100%, 80% 100%, 80% calc(100% - 3px), calc(100% - 3px) calc(100% - 3px), calc(100% - 3px) 80%, 100% 80%); }
.cust-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.result { text-align: center; padding: 26px 10px; }
.result .big { font: 600 40px var(--mono); }
