/* Customer-facing card styles, ported from the approved prototype
   (prototype/beaver-digital-card.html). Portal/dashboard styles arrive with
   their phases. Brand card fonts are OFL stand-ins set via CSS vars
   (--cardfont/--carddisp) so licensed Toyota/Mazda web fonts drop in later by
   swapping these two @font-face blocks. NEVER use the Tiller font. */

@font-face {
  font-family: 'Montserrat';
  src: url('/assets/fonts/montserrat-var.woff2') format('woff2-variations');
  font-weight: 100 900; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Figtree';
  src: url('/assets/fonts/figtree.woff2') format('woff2-variations');
  font-weight: 300 900; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Arsenal';
  src: url('/assets/fonts/arsenal-r.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Arsenal';
  src: url('/assets/fonts/arsenal-b.woff2') format('woff2');
  font-weight: 600 800; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Marcellus';
  src: url('/assets/fonts/marcellus.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}

:root {
  --ink: #16181d; --steel: #2a2e36; --fog: #f2f3f5; --line: #dcdfe4; --paper: #fff;
  --toyota: #eb0a1e; --mazda: #4f5560; --ok: #1a7f4e; --ms: #2f6fed;
  /* Card/lead-sheet surface tokens (light defaults; dark overrides below). */
  --card-text: #16181d; --card-muted: #6b7077; --card-line: #e8eaed;
  --field-bg: #fafbfc; --sheet-bg: #fff;
  color-scheme: light;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
body { font-family: 'Montserrat', system-ui, sans-serif; background: var(--fog); color: var(--ink); min-height: 100vh; }

/* The card speaks the brand's voice; platform chrome stays Montserrat. */
.card * { font-family: var(--cardfont, 'Montserrat'), sans-serif !important; }
.card .wordmark { font-family: var(--carddisp, var(--cardfont, 'Montserrat')), serif !important; }

.wrap { max-width: 480px; margin: 0 auto; padding: 18px 16px 60px; }
.wrap.wide { max-width: 760px; }

/* ---------- admin dashboard ---------- */
.statshead { margin-bottom: 16px; }
.statshead h1 { font-weight: 700; font-size: 28px; }
.statshead p { font-size: 13.5px; color: #666; margin-top: 3px; }
.filterbar { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-bottom: 18px; }
.filterbar .fgroup { display: flex; align-items: center; gap: 6px; }
.filterbar .fl { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: #8a909a; font-weight: 600; }
.filterbar a { text-decoration: none; font-size: 13px; color: #555; border: 1px solid var(--line); border-radius: 6px; padding: 5px 10px; background: #fff; }
.filterbar a.on { background: var(--ink); color: #fff; border-color: var(--ink); font-weight: 600; }
.filterbar .export { margin-left: auto; color: var(--ms); border-color: #d6e2fc; background: #eef3fe; font-weight: 600; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 18px; }
@media (max-width: 560px) { .kpis { grid-template-columns: repeat(2, 1fr); } }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 14px 12px; }
.kpi .n { font-weight: 700; font-size: 30px; line-height: 1; }
.kpi .l { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: #7a818b; margin-top: 5px; font-weight: 600; }
.deptsec { margin-bottom: 18px; }
.deptsec .dh { display: flex; align-items: baseline; gap: 9px; margin-bottom: 8px; }
.deptsec .dh h2 { font-size: 18px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.deptsec .dh .dc { font-size: 12px; color: #8a909a; font-weight: 500; }
.stafftable { background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.strow { display: grid; grid-template-columns: 1fr 60px 60px 60px; gap: 6px; align-items: center; padding: 13px 14px; border-bottom: 1px solid #eef0f2; font-size: 14px; }
.strow:last-child { border-bottom: none; }
.strow.hd { background: #fafbfc; font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: #7a818b; font-weight: 600; padding: 9px 14px; }
.strow .who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.strow .who .dot { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 600; font-size: 12px; flex: 0 0 auto; }
.strow .who .nm { font-weight: 600; line-height: 1.1; }
.strow .who .rl { font-size: 11.5px; color: #8a909a; }
.strow .num { text-align: center; font-weight: 600; font-size: 17px; }
.note { margin-top: 18px; background: #fff; border: 1px dashed var(--line); border-radius: 10px; padding: 14px; font-size: 13px; color: #666; line-height: 1.55; }
.adminnav { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.adminnav a { text-decoration: none; font-size: 13px; color: #555; border: 1px solid var(--line); border-radius: 6px; padding: 6px 11px; background: #fff; }
.adminnav a.on { background: var(--ink); color: #fff; border-color: var(--ink); font-weight: 600; }
.adminnav .signout { margin-left: auto; color: #666; }
.badge { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 10px; text-transform: uppercase; letter-spacing: .04em; }
.badge.delivered { background: #eef7f1; color: #1a7f4e; }
.badge.pending { background: #fff7e6; color: #b8860b; }
.badge.failed { background: #fdecea; color: #c0392b; }
.minibtn { background: var(--ink); color: #fff; border: none; border-radius: 6px; padding: 5px 10px; font-size: 12px; font-weight: 600; cursor: pointer; }
.biobox { background: #fafbfc; border: 1px solid #eef0f2; border-radius: 8px; padding: 10px 12px; font-size: 13.5px; line-height: 1.5; color: #4a4f57; }
.biobox.proposed { border-color: #d6e2fc; background: #f5f9ff; }
.modactions { display: flex; gap: 9px; margin-top: 10px; }

/* ---------- card ---------- */
.cardstage { perspective: 1400px; }
.card { position: relative; width: 100%; transform-style: preserve-3d; transition: transform .7s cubic-bezier(.4,.1,.2,1); cursor: pointer; }
@media (prefers-reduced-motion: reduce) { .card { transition: none; } }
.card.flipped { transform: rotateY(180deg); }
.face { backface-visibility: hidden; -webkit-backface-visibility: hidden; background: var(--paper); border-radius: 14px; overflow: hidden; box-shadow: 0 10px 30px rgba(20,22,28,.16), 0 2px 6px rgba(20,22,28,.08); display: flex; flex-direction: column; }
/* Front establishes the card height so long bios/photos can't clip the CTA;
   the QR back is overlaid on top of it for the 3D flip. */
.face.front { position: relative; min-height: 665px; }
.face.back { position: absolute; inset: 0; transform: rotateY(180deg); }
.stripe { height: 7px; width: 100%; flex: 0 0 auto; }

/* hero: store photo header — same image for every card in a brand */
.hero { position: relative; height: 218px; flex: 0 0 auto; background-size: cover; background-position: center; display: flex; flex-direction: column; }
.heroshade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(8,10,16,.30) 0%, rgba(8,10,16,.02) 32%, rgba(8,10,16,.55) 68%, rgba(10,12,18,.94) 100%); }
.brandbar { position: relative; display: flex; align-items: baseline; justify-content: space-between; padding: 13px 18px 0; }
.wordmark { font-weight: 800; font-size: 14.5px; letter-spacing: .12em; text-transform: uppercase; color: #fff; text-shadow: 0 1px 10px rgba(0,0,0,.55); }
.brandtag { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: rgba(255,255,255,.75); font-weight: 600; text-shadow: 0 1px 8px rgba(0,0,0,.6); }
.heroid { position: relative; margin-top: auto; display: flex; align-items: flex-end; gap: 13px; padding: 0 18px 14px; }
.avatar { width: 74px; height: 74px; border-radius: 10px; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 26px; border: 2.5px solid rgba(255,255,255,.92); box-shadow: 0 4px 14px rgba(0,0,0,.4); object-fit: cover; }
.heroid h1 { font-weight: 800; font-size: 23px; line-height: 1.02; color: #fff; text-shadow: 0 1px 8px rgba(0,0,0,.5); }
.heroid .role { font-size: 13.5px; color: rgba(255,255,255,.85); margin-top: 3px; font-weight: 500; text-shadow: 0 1px 6px rgba(0,0,0,.5); }
.brandrule { height: 4px; width: 100%; flex: 0 0 auto; }

.actions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; padding: 16px 22px 0; }
.actions a { text-decoration: none; text-align: center; border: 1px solid var(--card-line); border-radius: 8px; padding: 10px 4px 8px; color: var(--card-text); background: var(--field-bg); }
.actions a .ic { font-size: 16px; display: block; margin-bottom: 4px; line-height: 0; }
.actions a .ic svg { width: 19px; height: 19px; display: inline-block; color: var(--card-text); }
.actions a .lb { font-size: 12.5px; letter-spacing: .1em; text-transform: uppercase; font-weight: 600; color: var(--card-muted); }

.biocard { margin: 14px 22px 0; background: var(--field-bg); border: 1px solid var(--card-line); border-radius: 8px; padding: 11px 13px; font-size: 13.5px; line-height: 1.5; color: var(--card-text); }
.biocard .bk { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--card-muted); font-weight: 600; display: block; margin-bottom: 3px; }

.contactrows { padding: 12px 22px 0; font-size: 14px; color: var(--card-text); }
.contactrows div { padding: 6px 0; border-bottom: 1px solid var(--card-line); display: flex; gap: 10px; }
.contactrows div:last-child { border-bottom: none; }
.contactrows div > span:last-child { font-weight: 600; }
.contactrows .k { letter-spacing: .1em; text-transform: uppercase; font-size: 11.5px; color: var(--card-text); width: 64px; flex: 0 0 auto; padding-top: 2px; font-weight: 700; }

.cardcta { margin-top: auto; padding: 14px 22px 16px; display: flex; flex-direction: column; gap: 9px; }
.btn { border: none; border-radius: 8px; padding: 13px; cursor: pointer; width: 100%; font-size: 16px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.btn.primary { color: #fff; }
.btn.ghost { background: var(--card-text); border: 1.5px solid var(--card-text); color: var(--paper); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.fliphint { text-align: center; font-size: 12px; color: var(--card-muted); padding-bottom: 11px; }

.back .qrzone { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; }
.qrbox { background: #fff; padding: 14px; border: 1px solid var(--card-line); border-radius: 10px; }
.qrbox img { display: block; width: 185px; height: 185px; image-rendering: pixelated; }
.back .qrname { font-weight: 700; font-size: 22px; color: var(--card-text); }
.back .qrsub { font-size: 13.5px; color: var(--card-muted); text-align: center; max-width: 240px; line-height: 1.45; }

/* ---------- sheet (lead form) ---------- */
.sheetveil { position: fixed; inset: 0; background: rgba(16,18,22,.55); z-index: 80; display: none; align-items: flex-end; justify-content: center; }
.sheetveil.open { display: flex; }
.sheet { background: var(--sheet-bg); width: 100%; max-width: 480px; border-radius: 16px 16px 0 0; padding: 20px 20px 28px; max-height: 92vh; overflow-y: auto; }
.sheet .grab { width: 36px; height: 4px; border-radius: 2px; background: var(--card-line); margin: 0 auto 14px; }
.sheet h2 { font-size: 24px; font-weight: 700; color: var(--card-text); }
.sheet .sub { font-size: 13.5px; color: var(--card-muted); margin: 4px 0 16px; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12.5px; letter-spacing: .1em; text-transform: uppercase; font-weight: 600; color: var(--card-muted); margin-bottom: 5px; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid var(--card-line); border-radius: 8px; padding: 12px; font-family: inherit; font-size: 15px; background: var(--field-bg); color: var(--card-text); }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--card-text); outline-offset: 0; border-color: var(--card-text); }
.field input::placeholder, .field textarea::placeholder { color: var(--card-muted); opacity: .8; }
.consent { display: flex; gap: 9px; align-items: flex-start; font-size: 12.5px; color: var(--card-muted); margin: 6px 0 16px; line-height: 1.45; }
.consent input { margin-top: 2px; width: 16px; height: 16px; flex: 0 0 auto; }
.done { display: none; text-align: center; padding: 26px 6px 10px; }
.done .check { width: 58px; height: 58px; border-radius: 50%; background: var(--ok); color: #fff; font-size: 28px; display: flex; align-items: center; justify-content: center; margin: 0 auto 14px; }
.done h3 { font-size: 23px; font-weight: 700; margin-bottom: 6px; color: var(--card-text); }
.done p { font-size: 14px; color: var(--card-muted); line-height: 1.5; margin-bottom: 18px; }
.crmtag { display: inline-flex; align-items: center; gap: 7px; background: #eef7f1; color: var(--ok); border: 1px solid #cfe7d8; border-radius: 20px; font-size: 12.5px; font-weight: 600; padding: 5px 12px; margin-bottom: 18px; }
.formerror { color: #c0392b; font-size: 13px; margin-bottom: 10px; display: none; }
/* Honeypot field — visually and from the layout removed, kept in the DOM. */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- staff portal ---------- */
.portalhead { display: flex; align-items: center; gap: 13px; margin-bottom: 16px; }
.portalhead h1 { font-weight: 700; font-size: 24px; line-height: 1.05; }
.portalhead .sub { font-size: 12.5px; color: #7a818b; }
.portalhead .signout { margin-left: auto; background: none; border: 1px solid var(--line); border-radius: 6px; font-size: 12px; color: #666; padding: 6px 11px; cursor: pointer; text-decoration: none; }
.ptabs { display: flex; gap: 6px; margin-bottom: 16px; }
.ptabs a { flex: 1; text-align: center; text-decoration: none; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 9px; font-size: 13.5px; letter-spacing: .06em; text-transform: uppercase; font-weight: 600; color: #666; }
.ptabs a.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.cardpick { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; font-size: 13px; color: #7a818b; }
.cardpick a { text-decoration: none; border: 1px solid var(--line); border-radius: 20px; padding: 4px 12px; color: #555; background: #fff; }
.cardpick a.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 18px; }
.panel h3 { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.panel .psub { font-size: 12.5px; color: #7a818b; margin-bottom: 14px; line-height: 1.5; }
.lockedrow { position: relative; }
.lockedrow .syncbadge { position: absolute; right: 0; top: 0; display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 600; color: #2f6fed; background: #eef3fe; border: 1px solid #d6e2fc; border-radius: 12px; padding: 2px 8px; }
.leadrow { border-bottom: 1px solid #eef0f2; padding: 12px 0; font-size: 14px; }
.leadrow:last-child { border-bottom: none; }
.leadrow .ltop { display: flex; justify-content: space-between; align-items: baseline; }
.leadrow .lname { font-weight: 600; }
.leadrow .ltime { font-size: 11.5px; color: #9aa0a8; }
.leadrow .ldetail { font-size: 13px; color: #5a6068; margin-top: 3px; line-height: 1.45; }
.leadrow .ltag { display: inline-block; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; font-weight: 600; background: #f1f2f4; border-radius: 4px; padding: 2px 7px; margin-top: 5px; color: #555; }
.leadrow .ltag.crm { background: #eef7f1; color: #1a7f4e; }
.emptyleads { text-align: center; color: #9aa0a8; font-size: 13.5px; padding: 22px 10px; line-height: 1.55; }
.photoslot { display: flex; gap: 8px; margin-top: 4px; }
.photoslot .ph { flex: 1; aspect-ratio: 1; border: 1.5px dashed #c9cdd4; border-radius: 9px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #9aa0a8; font-size: 11.5px; gap: 4px; background: #fafbfc; }
.photoslot .ph .plus { font-size: 20px; line-height: 1; }
.photoslot .ph.disabled { opacity: .6; }
.photoslot .ph.filled { position: relative; border-style: solid; border-color: var(--line); background-size: cover; background-position: center; }
.photoslot .ph.filled form { position: absolute; top: 4px; right: 4px; margin: 0; }
.photodel { width: 22px; height: 22px; border-radius: 50%; border: none; background: rgba(16,18,22,.65); color: #fff; font-size: 12px; cursor: pointer; line-height: 1; }
.photoslot .ph.uploader { margin: 0; padding: 0; }
.addphoto { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; height: 100%; cursor: pointer; color: #9aa0a8; font-size: 12px; }
/* public card photo strip */
.photostrip { display: flex; gap: 8px; padding: 12px 22px 0; }
.photostrip img { width: 33%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; border: 1px solid #eef0f2; }
.walletbtns { display: flex; flex-direction: column; gap: 9px; margin-top: 6px; }
.wbtn { display: flex; align-items: center; justify-content: center; gap: 9px; border-radius: 9px; padding: 13px; border: none; cursor: pointer; font-size: 15px; font-weight: 600; }
.wbtn.apple { background: #000; color: #fff; }
.wbtn.google { background: #fff; color: #1f1f1f; border: 1.5px solid #747775; }
.wbtn:disabled { opacity: .55; cursor: default; }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(70px); background: var(--card-text); color: var(--paper); padding: 11px 18px; border-radius: 8px; font-size: 14px; transition: transform .3s; z-index: 99; max-width: 90vw; text-align: center; }
.toast.show { transform: translateX(-50%) translateY(0); }

/* ---------- contact-row mini actions + cell phone (§10) ---------- */
.contactrows a { color: var(--card-text); text-decoration: none; font-weight: 600; }
.miniaction { display: inline-block; margin-left: 8px; font-size: 12px; font-weight: 600; border: 1px solid var(--line); border-radius: 6px; padding: 1px 8px; color: var(--accent, var(--ms)); }

/* ---------- photo gallery + lightbox (§11) ---------- */
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 12px 22px 0; }
.gthumb { padding: 0; border: none; background: none; cursor: pointer; }
.gallery img { width: 100%; aspect-ratio: 1; object-fit: contain; background: var(--field-bg); border-radius: 8px; border: 1px solid var(--card-line); display: block; }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.92); display: none; align-items: center; justify-content: center; z-index: 200; }
.lightbox.on { display: flex; }
.lbimg { max-width: 94vw; max-height: 86vh; object-fit: contain; border-radius: 8px; }
.lbclose { position: absolute; top: 14px; right: 16px; }
.lbnav { position: absolute; top: 50%; transform: translateY(-50%); font-size: 40px; line-height: 1; }
.lbnav.prev { left: 8px; } .lbnav.next { right: 8px; }
.lbclose, .lbnav { background: rgba(255,255,255,.12); color: #fff; border: none; border-radius: 999px; width: 46px; height: 46px; font-size: 22px; cursor: pointer; }

/* ---------- dual logo + dark/light theming (§12) ---------- */
:root, :root[data-theme="light"] {
  --bg: #ffffff; --surface: #f4f4f6; --text: #1a1a1a; --text-muted: #5f6368; --border: rgba(0,0,0,.12);
}
:root[data-theme="dark"] {
  --bg: #0e0e10; --surface: #1a1a1d; --text: #f2f2f2; --text-muted: #a0a0a8; --border: rgba(255,255,255,.12);
  /* Theme the page canvas; cards/panels keep their own surface styling. */
  --fog: #0e0e10; --ink: #f2f2f2;
  /* Dark card + lead-sheet surfaces (dark paper, light text, low-contrast lines). */
  --paper: #1b1d22; --card-text: #f1f2f4; --card-muted: #a6abb3;
  --card-line: rgba(255,255,255,.13); --field-bg: #24262c; --sheet-bg: #1b1d22;
  color-scheme: dark;
}
body { background: var(--bg); color: var(--text); transition: background .2s, color .2s; }
.cards-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; max-width: 760px; margin: 0 auto; }
.dual-logo img { height: 48px; width: auto; display: block; }
.logo-dark { display: none; }
:root[data-theme="dark"] .logo-light { display: none; }
:root[data-theme="dark"] .logo-dark { display: block; }
.theme-toggle { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 999px; width: 40px; height: 40px; font-size: 18px; cursor: pointer; }
