:root {
  /* Tukios brand */
  --brand: #2e9a3c;
  --brand-light: #b5d453;
  --brand-grad: linear-gradient(135deg, #8cc63f 0%, #2e9a3c 100%);
  --brand-text: #237a2f; /* darker green for small text on white */
  --dark: #1f2622;
  --accent: var(--brand);
  --accent-press: #247a30;
  --bg: #f4f6f3;
  --card: #ffffff;
  --ink: #1f2622;
  --muted: #687068;
  --line: #dfe5dc;
  --green: #12805c;
  --green-bg: #e3f5ee;
  --blue-bg: #e7f0ff;
  --amber: #9a5b00;
  --amber-bg: #fff3dc;
  --red: #b42318;
  --red-bg: #fde8e7;
  --radius: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea { font: inherit; font-size: 16px; } /* 16px stops iOS zoom-on-focus */
[hidden] { display: none !important; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px;
  background: #fff; color: var(--ink); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-name { font-weight: 700; letter-spacing: .2px; }
.brand-name span { color: var(--brand); }
.brand-event { font-size: 12px; color: var(--muted); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line);
  background: var(--brand) center/cover no-repeat; color: #fff; font-weight: 700; font-size: 14px;
}

.banner {
  padding: 10px 16px; font-size: 14px; background: var(--amber-bg); color: var(--amber);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.banner.error { background: var(--red-bg); color: var(--red); }
.banner button { background: none; border: 1px solid currentColor; border-radius: 999px; padding: 4px 12px; font-size: 13px; font-weight: 600; }

.view { max-width: 720px; margin: 0 auto; padding: 16px 16px calc(24px + var(--safe-b)); }

/* Home */
.scan-card { text-align: center; }
.btn-scan {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 26px 16px; border: 0; border-radius: 20px;
  background: var(--brand-grad); color: #fff; font-size: 22px; font-weight: 700;
  box-shadow: 0 8px 24px rgba(46,154,60,.32);
}
.btn-scan:active { filter: brightness(.94); transform: scale(.99); }
.scan-alt { margin-top: 12px; display: flex; justify-content: center; gap: 10px; color: var(--muted); }
.link { background: none; border: 0; padding: 6px 4px; color: var(--brand-text); font-weight: 600; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 20px 0 8px; }
.stats.three { grid-template-columns: repeat(3, 1fr); margin-bottom: 4px; }
.stats-label { margin: 18px 2px -10px; font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
#youLabel { margin-top: 14px; }
.stats.three + .stats-label + .stats { margin-top: 20px; }
.stat { background: var(--card); border-radius: var(--radius); padding: 12px 4px; text-align: center; border: 1px solid var(--line); }
.stat b { display: block; font-size: 24px; }
.stat span { font-size: 12px; color: var(--muted); white-space: nowrap; }

.list-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; }
.list-head h2 { font-size: 18px; margin: 0; }
.list-head input {
  flex: 0 1 200px; min-width: 0; padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card);
}
.lead-list { list-style: none; padding: 0; margin: 10px 0 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.lead-item {
  display: flex; gap: 12px; align-items: center; width: 100%; text-align: left;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px;
}
.lead-thumb { width: 52px; height: 52px; flex: none; border-radius: 10px; object-fit: cover; background: var(--bg); }
.lead-main { flex: 1; min-width: 0; }
.lead-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lead-sub { font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lead-tags { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px; }
.demo-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.demo-head h3 { margin: 0; }
.demo-toggle { border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 10px 16px; font-weight: 800; }
.demo-toggle[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.demo-body { margin-top: 12px; }
.demo-hint { margin: 0 0 4px; font-size: 13px; font-weight: 600; color: var(--brand-text); }
.demo-body h4 { margin: 12px 0 8px; font-size: 14px; }
.demo-line { width: 100%; text-align: left; margin: 14px 0 12px; padding: 10px 12px; border: 1.5px dashed var(--accent); border-radius: 12px; background: #eef8ef; color: var(--ink); font-weight: 600; }
.demo-line.added { border-style: solid; color: var(--brand-text); }
.segmented.locked button { pointer-events: none; opacity: .55; }
.segmented.locked button[aria-pressed="true"] { opacity: 1; }
.tag.Demoed { background: var(--green); color: #fff; }
.lead-hs { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.tag { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--bg); color: var(--muted); }
.tag.found { background: var(--blue-bg); color: #1f5fbf; }
.tag.not_found { background: var(--amber-bg); color: var(--amber); }
.tag.Hot { background: var(--red-bg); color: var(--red); }
.sync-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--green); }
.sync-dot.pending { background: #f5a524; }
.sync-dot.error { background: var(--red); }
.empty { text-align: center; color: var(--muted); padding: 24px 8px; }

/* Form */
.form-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.back { font-size: 17px; padding-left: 0; }
.read-status { font-size: 13px; font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.read-status.ok { color: var(--green); }
.read-status.warn { color: var(--amber); }
.spinner { width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.photo-wrap { position: relative; margin-bottom: 12px; }
.photo-wrap img { width: 100%; max-height: 220px; object-fit: contain; background: #000; border-radius: var(--radius); display: block; }
.retake { position: absolute; right: 8px; bottom: 8px; background: rgba(0,0,0,.6); color: #fff; border-radius: 999px; padding: 6px 12px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.card h3 { margin: 0 0 10px; font-size: 15px; }
label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 10px; }
label:last-child { margin-bottom: 0; }
label input, textarea {
  display: block; width: 100%; margin-top: 4px; padding: 11px 12px;
  border: 1px solid var(--line); border-radius: 10px; background: #fbfcfa; color: var(--ink);
}
label input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; background: #fff; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid2 label { margin-bottom: 10px; }
.city-state { grid-template-columns: 2fr 1fr; }

/* Products: a tidy list of tick boxes, one per line, the same for "Interested in" and "What did you demo?" */
.chips { display: grid; grid-template-columns: 1fr; gap: 6px; }
.chip {
  display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 10px 14px; text-align: left;
  border: 1.5px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink);
  font-size: 15px; font-weight: 600; line-height: 1.25;
}
.chip::before {
  content: ""; flex: none; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 7px;
  border: 2px solid #c9d1c6; background: #fff; color: #fff; font-size: 14px; font-weight: 900; line-height: 1;
}
.chip[aria-pressed="true"] { border-color: var(--accent); background: #eef8ef; }
.chip[aria-pressed="true"]::before { content: "✓"; border-color: var(--accent); background: var(--accent); }
.chip:active { filter: brightness(.96); }

.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.segmented button:disabled { opacity: .4; }
.segmented button { border: 1.5px solid var(--line); background: #fff; border-radius: 10px; padding: 11px 0; font-weight: 700; }
.segmented button[aria-pressed="true"][data-v="Hot"] { background: var(--red); border-color: var(--red); color: #fff; }
.segmented button[aria-pressed="true"][data-v="Warm"] { background: #e08a00; border-color: #e08a00; color: #fff; }
.segmented button[aria-pressed="true"][data-v="Cold"] { background: #4b6a91; border-color: #4b6a91; color: #fff; }

.hubspot { border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px; font-size: 14px; border: 1px solid var(--line); background: var(--card); }
.hubspot .hs-title { font-weight: 800; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.hubspot .hs-line { color: var(--ink); margin-top: 4px; }
.hubspot .hs-meta { color: var(--muted); margin-top: 2px; }
.hubspot a { color: inherit; font-weight: 700; }
.hubspot.found { background: var(--blue-bg); border-color: #c4d8fb; color: #1f5fbf; }
.hubspot.not_found { background: var(--amber-bg); border-color: #f3d79d; color: var(--amber); }
.hubspot.loading, .hubspot.error { color: var(--muted); }

/* Log in HubSpot: the last step before saving */
.hslog h3 { margin-bottom: 2px; }
.hs-sub { margin: 0 0 12px; color: var(--muted); font-size: 14px; }
.hs-choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.hs-choices button { border: 1.5px solid var(--line); background: #fff; border-radius: 12px; padding: 10px 4px; color: var(--ink); line-height: 1.2; }
.hs-choices button b { display: block; font-size: 15px; }
.hs-choices button small { display: block; margin-top: 3px; font-size: 11.5px; color: var(--muted); }
.hs-choices button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.hs-choices button[aria-pressed="true"] small { color: rgba(255,255,255,.85); }
.hs-choices button:disabled { opacity: .45; }

.hs-status { margin: 0; padding: 12px 14px; border-radius: 12px; font-size: 15px; font-weight: 700; }
.hs-status.ok { background: #e8f6ea; color: var(--brand-text); }
.hs-status.bad { background: var(--red-bg); color: var(--red); }
.hs-status.wait { background: var(--amber-bg); color: var(--amber); }
.hs-status:not([hidden]) + .hs-choices { margin-top: 12px; }

.hs-rec { margin-top: 12px; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 14px; background: #fff; }
.hs-rec.ask { border-color: #f0d394; background: #fffaf0; }
.hs-rec.ok { border-color: #bfe3c6; background: #f3fbf4; }
.hs-rec.new { border-color: #c4d8fb; background: #f3f7ff; }
.hs-rec.none { border-style: dashed; }
.hs-rec.none .hs-rec-name { color: var(--muted); font-weight: 700; }
.hs-rec-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.hs-rec-label { font-size: 11.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.hs-badge { padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.hs-rec.ask .hs-badge { background: var(--amber-bg); color: var(--amber); }
.hs-rec.ok .hs-badge { background: #dcf1e0; color: var(--brand-text); }
.hs-rec.new .hs-badge { background: #dde9ff; color: #1f5fbf; }
.hs-rec-name { margin-top: 6px; font-size: 17px; font-weight: 800; color: var(--ink); overflow-wrap: anywhere; }
.hs-rec-sub { margin-top: 1px; font-size: 14px; color: var(--muted); overflow-wrap: anywhere; min-width: 0; }
.hs-rec-subrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 4px; }
.hs-rec-subrow .hs-link { flex: none; }
.hs-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.hs-btn { border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 10px; background: #fff; color: var(--ink); font-size: 15px; font-weight: 700; }
.hs-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.hs-btn.wide { display: block; width: 100%; margin-top: 10px; }
.hs-btn:active, .hs-choices button:active { filter: brightness(.95); }
.hs-link { border: 0; background: none; padding: 6px 0; color: var(--brand-text); font-size: 15px; font-weight: 700; }

.hs-panel { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.hs-panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-weight: 800; }
.hs-search { display: flex; gap: 8px; }
.hs-search input { flex: 1; min-width: 0; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; font-size: 16px; }
.hs-search button { border: 0; border-radius: 12px; padding: 0 16px; background: var(--dark); color: #fff; font-weight: 700; }
.hs-results { margin-top: 8px; display: grid; gap: 6px; }
.hs-result { text-align: left; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; }
.hs-result b { display: block; font-size: 15px; }
.hs-result span { display: block; font-size: 13px; color: var(--muted); }
.hs-muted { color: var(--muted); font-size: 14px; padding: 4px 2px; }
.hs-note { margin: 8px 0 0; font-size: 13px; color: var(--muted); text-align: center; }
.hs-preview { margin: 14px 0 0; padding: 12px 14px; border-radius: 12px; font-size: 14px; font-weight: 600; line-height: 1.35; }
.hs-preview.todo { background: var(--amber-bg); color: var(--amber); }
.hs-preview.ready { background: #e8f6ea; color: var(--brand-text); }
.tag.Logged { background: var(--green-bg); color: var(--green); }
.tag.Failed { background: var(--red-bg); color: var(--red); }
.attendee { border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px; font-size: 14px; border: 1px solid #bfe3d3; background: var(--green-bg); color: var(--green); }
.attendee .at-title { font-weight: 800; font-size: 15px; }
.attendee .at-match { margin-top: 10px; padding-top: 10px; border-top: 1px solid #bfe3d3; }
.attendee .at-title + .at-match { margin-top: 8px; padding-top: 0; border-top: 0; }
.attendee .at-line { color: var(--ink); margin-top: 4px; }
.attendee .at-meta { color: var(--muted); margin-top: 2px; word-break: break-word; }
.attendee .at-use { margin-top: 8px; border: 0; border-radius: 10px; padding: 10px 14px; font-weight: 700; background: var(--green); color: #fff; }

.dupe { background: var(--amber-bg); color: var(--amber); border-radius: var(--radius); padding: 10px 14px; font-size: 14px; margin-bottom: 12px; }
.dupe button { margin-left: 6px; }
.qr-raw { font-size: 12px; color: var(--muted); word-break: break-all; margin: 0 4px 12px; }

.btn-delete { display: block; width: 100%; margin: 4px 0 18px; padding: 14px; border: 1.5px solid var(--red); border-radius: 14px; background: #fff; color: var(--red); font-size: 16px; font-weight: 700; }
.btn-delete[hidden] { display: none; }
.btn-delete:active { background: var(--red-bg); }

.save-bar {
  position: sticky; bottom: 0; margin: 0 -16px; padding: 12px 16px calc(12px + var(--safe-b));
  background: linear-gradient(to top, var(--bg) 70%, rgba(244,246,243,0));
}
.btn-primary {
  width: 100%; border: 0; border-radius: 14px; padding: 16px; font-size: 18px; font-weight: 800;
  background: var(--brand-grad); color: #fff; box-shadow: 0 6px 18px rgba(46,154,60,.28);
}
.btn-primary:active { filter: brightness(.94); }
.btn-primary:disabled { opacity: .6; }

/* Menu + toast */
.menu {
  position: fixed; top: calc(60px + env(safe-area-inset-top, 0px)); right: 12px; z-index: 20; min-width: 220px;
  background: var(--card); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(15,27,45,.25); overflow: hidden;
}
.menu-user { padding: 12px 14px; font-size: 14px; color: var(--muted); border-bottom: 1px solid var(--line); }
.menu-user b { display: block; color: var(--ink); }
.menu button { display: block; width: 100%; text-align: left; padding: 12px 14px; border: 0; background: none; font-weight: 600; }
.menu button + button { border-top: 1px solid var(--line); }
.menu .danger { color: var(--red); }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translate(-50%, 140%);
  background: var(--dark); color: #fff; padding: 12px 18px; border-radius: 999px; font-weight: 600; font-size: 15px;
  transition: transform .25s ease, opacity .25s ease; z-index: 30; max-width: calc(100vw - 32px); text-align: center;
  opacity: 0; pointer-events: none;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

/* Login */
.login-body { background: #fff; color: var(--ink); min-height: 100vh; display: grid; place-items: center; }
.login { text-align: center; padding: 32px 16px; max-width: 360px; }
.login h1 { margin: 12px 0 4px; }
.login .muted { color: var(--muted); }
.login h1 span { color: var(--brand); }
.login .small { font-size: 13px; }
.login-logo { display: block; margin: 0 auto; }
.login-button { display: flex; justify-content: center; margin: 28px 0 12px; min-height: 44px; }
.error-box { background: var(--red-bg); color: var(--red); border-radius: 10px; padding: 10px 12px; }
.dev { margin-top: 24px; display: grid; gap: 8px; }
.dev input { padding: 10px; border-radius: 10px; border: 1px solid var(--line); }
.dev button { padding: 10px; border-radius: 10px; border: 0; background: var(--dark); color: #fff; font-weight: 700; }

@media (min-width: 700px) {
  .view { padding-top: 24px; }
  .btn-scan { padding: 32px; }
}

/* Call count hint, follow-up card */
.label-hint { font-weight: 500; color: var(--muted); }
.fu select { width: 100%; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; font-size: 16px; color: var(--ink); }
.fu-done, .fu-wait { padding: 12px 14px; border-radius: 14px; border: 1.5px solid #bfe3c6; background: #f3fbf4; }
.fu-wait { border-color: #f0d394; background: #fffaf0; }
.fu-done-title { font-size: 17px; font-weight: 800; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.fu-done .fu-done-title { color: var(--brand-text); }
.fu-done-line { margin-top: 4px; font-size: 15px; font-weight: 700; color: var(--ink); }
.fu-done-meta { margin-top: 4px; font-size: 13px; color: var(--muted); }
.fu-done-meta b { display: block; margin-top: 4px; color: var(--amber); }
.fu-links { display: flex; justify-content: space-between; margin-top: 6px; }
.hs-rec-foot { display: flex; justify-content: flex-end; margin-top: 4px; }
.tag.Followup { background: #e8f6ea; color: var(--brand-text); }

/* Leaderboard & stats */
.stats-link { display: block; width: 100%; margin: 10px 0 0; padding: 12px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--card); color: var(--brand-text); font-weight: 800; font-size: 15px; }
.page-title { margin: 4px 2px 12px; font-size: 22px; }
.day-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 4px; }
.day-tabs button { flex: none; padding: 9px 14px; border: 1.5px solid var(--line); border-radius: 999px; background: #fff; font-weight: 700; font-size: 14px; color: var(--ink); }
.day-tabs button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.contest-banner { margin: 12px 0 -6px; padding: 12px 14px; border-radius: 14px; background: linear-gradient(135deg, #fff6d8, #ffe9a8); color: #6b4a00; font-weight: 800; }
.board ol { list-style: none; margin: 4px 0 0; padding: 0; }
.board li { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 8px; padding: 10px 6px; border-top: 1px solid var(--line); font-size: 15px; }
.board li:first-child { border-top: 0; }
.board li.me { background: #eef8ef; border-radius: 10px; }
.board li.none { color: var(--muted); }
.board .rank { font-weight: 800; text-align: center; }
.board .who { font-weight: 700; overflow-wrap: anywhere; }
.board .val { color: var(--muted); font-size: 14px; text-align: right; }
.board.contest { border: 2px solid #f0c24b; }
