/* Penman Connect. One screen-width column, thumb-sized targets, light only
   (the QR code needs a white ground and conference halls are bright).

   Brand: the Penman Consulting Design System. Palette, type, radii and shadows below are its
   tokens (brand block of colors_and_type.css); the logo is its official lockup, never redrawn.
   Voice: British English, sentence case, no exclamation marks, no emoji. */

@font-face { font-family: 'Open Sauce Sans'; font-weight: 400; font-display: swap; src: url('/fonts/open-sauce-sans-400.woff') format('woff'); }
@font-face { font-family: 'Open Sauce Sans'; font-weight: 500; font-display: swap; src: url('/fonts/open-sauce-sans-500.woff') format('woff'); }
@font-face { font-family: 'Open Sauce Sans'; font-weight: 600; font-display: swap; src: url('/fonts/open-sauce-sans-600.woff') format('woff'); }
@font-face { font-family: 'Open Sauce Sans'; font-weight: 700; font-display: swap; src: url('/fonts/open-sauce-sans-700.woff') format('woff'); }

:root {
  /* Brand palette */
  --navy: #03335d;          /* brand primary */
  --navy-2: #022845;
  --action: #0056a2;        /* brand blue: buttons, links */
  --action-hover: #00427d;
  --bright: #0c9df4;        /* focus, highlights */

  /* Neutrals */
  --ink: #16252e;
  --ink-soft: #5a6b73;      /* slate */
  --paper: #f4f7fa;         /* sand: the page */
  --surface: #ffffff;
  --line: #d7dce0;          /* mute */

  /* Status triads: base for dots, deep for text, tint for backgrounds */
  --ok: #4ca154;
  --green: #31703a;
  --green-wash: #e9f3ea;
  --warn: #ffa84d;
  --amber: #8f5a0e;
  --amber-wash: #fcefdd;
  --err: #d9622b;
  --red: #a63e14;
  --red-wash: #fae7de;

  --radius-md: 8px;
  --radius: 14px;           /* radius-lg */
  --radius-xl: 24px;
  --shadow-1: 0 1px 2px rgba(2, 74, 135, 0.06);
  --shadow-3: 0 8px 24px rgba(2, 74, 135, 0.14);
  --font: 'Open Sauce Sans', Arial, system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.45 var(--font);
  -webkit-tap-highlight-color: transparent;
}

[hidden] { display: none !important; }

#app {
  max-width: 30rem;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 1rem) 1.125rem calc(env(safe-area-inset-bottom) + 2rem);
}

.view.center {
  min-height: 80vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1rem;
}

h1, h2, p { margin: 0; }

h1 {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.015em;
}

h2 {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 2rem 0 0.75rem;
}

.view > p { margin-bottom: 1rem; }

.quiet { color: var(--ink-soft); font-size: 0.9375rem; }

.error {
  color: var(--red);
  background: var(--red-wash);
  border-radius: 10px;
  padding: 0.75rem 0.875rem;
  font-size: 0.9375rem;
}

:focus-visible {
  outline: 3px solid var(--bright);
  outline-offset: 2px;
}

/* ---------- buttons ---------- */

button { font: inherit; color: inherit; cursor: pointer; }

.button {
  display: block;
  width: 100%;
  min-height: 3.375rem;
  padding: 0.875rem 1rem;
  border: 1.5px solid var(--line);
  border-radius: 999px; /* brand buttons are pills */
  background: var(--surface);
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  color: var(--ink);
}

.button.primary {
  background: var(--action);
  border-color: var(--action);
  color: #fff;
}

.button.primary:active { background: var(--action-hover); }

.button.danger {
  margin-top: 0.75rem;
  border-color: transparent;
  background: none;
  color: var(--red);
}

.link {
  border: 0;
  background: none;
  padding: 0.5rem 0.25rem;
  color: var(--action);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- header bar on inner screens ---------- */

.bar {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  margin-bottom: 1rem;
}

.back {
  border: 0;
  background: none;
  padding: 0.5rem 0.75rem 0.5rem 0;
  min-height: 2.75rem;
  color: var(--action);
  font-weight: 600;
}

.back::before { content: '‹ '; }

/* ---------- forms ---------- */

form { display: grid; gap: 0.875rem; }

label {
  display: grid;
  gap: 0.3rem;
  font-size: 0.9375rem;
  font-weight: 600;
}

.optional { font-weight: 400; color: var(--ink-soft); }

label:has(.optional) { grid-template-columns: auto 1fr; column-gap: 0.4rem; }
label:has(.optional) > input,
label:has(.optional) > textarea { grid-column: 1 / -1; }

input, textarea {
  width: 100%;
  min-height: 3.125rem;
  padding: 0.75rem 0.875rem;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink);
  font: 400 1.0625rem/1.3 var(--font); /* 17px: stops iOS zooming the page on focus */
}

input:focus, textarea:focus {
  outline: 0;
  border-color: var(--action);
  box-shadow: 0 0 0 3px rgb(12 157 244 / 0.25);
}

textarea { resize: vertical; }

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }

/* ---------- home: event ---------- */

.event { margin-bottom: 0; }

.event span { color: var(--ink-soft); font-weight: 500; }

.event input {
  border-color: transparent;
  background: transparent;
  padding-left: 0;
  min-height: 2.5rem;
  font-size: 1.1875rem;
  font-weight: 600;
  border-radius: 0;
  border-bottom: 1.5px dashed var(--line);
}

.event input:focus { box-shadow: none; border-bottom-color: var(--action); border-bottom-style: solid; }

/* ---------- home: the lanyard badge ---------- */

.lanyard {
  position: relative;
  height: 3.25rem;
  margin-top: 0.5rem;
  overflow: hidden;
}

/* two strap ends running down into the badge's slot */
.lanyard::before,
.lanyard::after {
  content: '';
  position: absolute;
  bottom: -1.25rem;
  left: 50%;
  width: 1.125rem;
  height: 8rem;
  background: var(--navy);
  transform-origin: bottom center;
}

.lanyard::before { transform: translateX(-50%) rotate(-24deg); background: var(--navy-2); }
.lanyard::after { transform: translateX(-50%) rotate(24deg); }

.badge {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 2.75rem 1.25rem 1.25rem;
  text-align: center;
  box-shadow: var(--shadow-3);
}

.badge-slot {
  position: absolute;
  top: 0.875rem;
  left: 50%;
  width: 3.5rem;
  height: 0.75rem;
  transform: translateX(-50%);
  border-radius: 999px;
  background: var(--paper);
  box-shadow: inset 0 1px 2px rgb(16 39 43 / 0.25);
}

.badge h1 { font-size: 1.875rem; font-weight: 700; }

/* The official lockup. Sized by height; never recoloured, stretched or redrawn. */
.logo { display: block; height: 2.75rem; width: auto; }
.badge .logo { height: 2.25rem; margin: 0 auto 1rem; }
.view.center .logo { height: 3.25rem; margin-bottom: 0.5rem; align-self: flex-start; }

#badge-role { color: var(--ink-soft); margin-top: 0.25rem; }

.qr {
  width: min(100%, 17rem);
  margin: 1rem auto 0.5rem;
}

.qr svg { display: block; width: 100%; height: auto; }

.badge-hint {
  max-width: 22rem;
  margin: 0 auto 1rem;
  font-size: 0.9375rem;
  color: var(--ink-soft);
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: var(--paper);
}

.segmented button {
  min-height: 2.75rem;
  border: 0;
  border-radius: 9px;
  background: none;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.segmented button[aria-pressed='true'] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px rgb(16 39 43 / 0.18);
}

.segmented button:disabled { opacity: 0.45; }

.opener {
  margin: 1rem 0.25rem 0;
  font-size: 0.9375rem;
  color: var(--ink-soft);
  text-align: center;
}

/* ---------- home: capture actions ---------- */

.actions {
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow-1);
}

.action {
  position: relative;
  display: grid;
  gap: 0.1rem;
  width: 100%;
  min-height: 4.25rem;
  padding: 0.875rem 2.5rem 0.875rem 1rem;
  border: 0;
  border-bottom: 1px solid var(--paper);
  background: none;
  text-align: left;
}

.action:last-child { border-bottom: 0; }
.action:active { background: var(--paper); }
.action strong { font-weight: 600; }
.action span { font-size: 0.9375rem; color: var(--ink-soft); }

.action::after {
  content: '';
  position: absolute;
  right: 1.125rem;
  top: 50%;
  width: 0.55rem;
  height: 0.55rem;
  border-right: 2px solid var(--action);
  border-top: 2px solid var(--action);
  transform: translateY(-50%) rotate(45deg);
}

/* ---------- home: status ---------- */

.status {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  width: 100%;
  min-height: 3.25rem;
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border: 0;
  border-radius: var(--radius);
  background: none;
  text-align: left;
  font-size: 0.9375rem;
}

#status-text { flex: 1; }

.status-link { color: var(--action); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

.dot {
  flex: none;
  width: 0.625rem;
  height: 0.625rem;
  border-radius: 50%;
  background: var(--line);
}

.dot.ok { background: var(--ok); }
.dot.wait { background: var(--warn); }
.dot.warn { background: var(--err); }

.install {
  margin-top: 0.5rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  background: var(--amber-wash);
  font-size: 0.9375rem;
}

.foot { margin-top: 1rem; text-align: center; }

/* ---------- scanner ---------- */

.scanner {
  position: relative;
  aspect-ratio: 1;
  margin-bottom: 1rem;
  border-radius: 20px;
  overflow: hidden;
  background: var(--ink);
}

.scanner video { width: 100%; height: 100%; object-fit: cover; }

.scan-frame {
  position: absolute;
  inset: 14%;
  border: 3px solid rgb(255 255 255 / 0.9);
  border-radius: 18px;
}

/* ---------- photo previews ---------- */

#reading-photo, #form-photo {
  display: block;
  width: 100%;
  max-height: 14rem;
  object-fit: contain;
  border-radius: var(--radius);
  background: var(--ink);
  margin-bottom: 1rem;
}

/* ---------- saved leads ---------- */

.leads { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: 0.5rem; }

.lead {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  min-height: 4rem;
  padding: 0.75rem 1rem;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface);
  text-align: left;
}

.lead-main { flex: 1; min-width: 0; display: grid; }
.lead-main strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lead-main span { font-size: 0.875rem; color: var(--ink-soft); }

.chip {
  flex: none;
  padding: 0.25rem 0.625rem;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
}

.chip.sent { background: var(--green-wash); color: var(--green); }
.chip.pending { background: var(--amber-wash); color: var(--amber); }
.chip.review, .chip.failed { background: var(--red-wash); color: var(--red); }

#leads-send { margin-bottom: 0.5rem; }

/* ---------- toast ---------- */

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 1.25rem);
  max-width: calc(100vw - 2rem);
  padding: 0.75rem 1.125rem;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 0.9375rem;
  transform: translate(-50%, 200%);
  visibility: hidden;
  transition: transform 0.25s ease, visibility 0.25s;
  pointer-events: none;
}

#toast.show { transform: translate(-50%, 0); visibility: visible; }

@media (prefers-reduced-motion: reduce) {
  #toast { transition: none; }
}

/* ---------- public card page (/c/) ---------- */

.card-page .badge { margin-bottom: 1.5rem; }
.card-page .contact-lines { display: grid; gap: 0.25rem; margin: 1rem 0 1.25rem; }
.card-page .contact-lines a { color: var(--action); font-weight: 600; overflow-wrap: anywhere; }
.card-page .trap { position: absolute; left: -200vw; }
.card-page .done {
  padding: 1.25rem;
  border-radius: var(--radius);
  background: var(--green-wash);
  color: var(--green);
  font-weight: 600;
}

/* ---------- onboarding: card preview, missing-detail hints, how it works ---------- */

.preview {
  display: grid;
  gap: 0.15rem;
  margin-bottom: 1.25rem;
  padding: 1rem 1.125rem;
  border-radius: var(--radius);
  background: var(--surface);
  border-left: 5px solid var(--navy);
  box-shadow: var(--shadow-1);
}

.preview strong { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.01em; }
.preview span { font-size: 0.9375rem; color: var(--ink-soft); overflow-wrap: anywhere; }
.preview span:empty { display: none; }

.hint {
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--amber);
}

.howto { list-style: none; margin: 0 0 1.25rem; padding: 0; display: grid; gap: 0.5rem; }

.howto li {
  display: grid;
  gap: 0.15rem;
  padding: 0.875rem 1rem;
  border-radius: var(--radius);
  background: var(--surface);
}

.howto strong { font-weight: 600; }
.howto span { font-size: 0.9375rem; color: var(--ink-soft); }

#view-welcome .install { display: grid; gap: 0.2rem; margin: 0 0 1.25rem; }
