/* Booth leads (js/booth-leads.js): the Leads view of the booth studio and its scanner.
   Loads after css/booth-studio.css, whose variables, buttons, inputs and cards it uses. */

.bst {
    --lead-hot: #c2410c;
    --lead-hot-bg: #ffefe8;
    --lead-hot-line: #f7bfa8;
    --lead-warm: #a15c07;
    --lead-warm-bg: #fff5d9;
    --lead-warm-line: #f1d48c;
    --lead-cold: #1f5fae;
    --lead-cold-bg: #e9f2ff;
    --lead-cold-line: #b9d3f5;
    --scan-ink: #061b19;
}

.bst-panel[data-view='leads'] .bst-editor,
.bst-panel[data-view='leads'] .bst-welcome,
.bst-panel[data-view='leads'] .bst-foot {
    display: none;
}

/* ---------- the view ---------- */
.bst-leads:not([hidden]) {
    display: flex;
    flex-direction: column;
}

.bst-leads-inner {
    display: flex;
    flex: 1 0 auto;
    flex-direction: column;
    width: 100%;
    max-width: 860px;
}

.bst-leads-head {
    align-items: center;
    flex-wrap: nowrap;
    margin-bottom: 4px;
}

.bst-leads-scan {
    flex: none;
}

.bst .bst-leads-scan .exh-icon,
.bst .bst-leads-dock .exh-icon,
.bst .bst-leads-empty .bst-btn .exh-icon {
    width: 18px;
    height: 18px;
}

.bst-leads-dock {
    display: none;
}

.bst-leads-fine {
    margin-top: 16px;
}

/* Scans waiting on the phone, and the ones the server refused */
.bst-leads-note {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    padding: 9px 10px 9px 14px;
    border: 1px solid #f2dcae;
    border-radius: 12px;
    background: #fff8eb;
    color: #7a4a00;
    font-size: 0.84rem;
    line-height: 1.4;
    animation: bstIn 0.2s ease both;
}

.bst-leads-note > span:not(.bst-spinner) {
    flex: 1;
    min-width: 0;
}

.bst-leads-note strong {
    font-weight: 650;
}

.bst-leads-note.is-bad {
    border-color: #f1c2bc;
    background: #fff4f2;
    color: #8a2c1f;
}

.bst-leads-note .bst-spinner {
    margin-right: 6px;
}

.bst-leads-more-bad {
    margin: 6px 2px 0;
    color: var(--exh-muted);
    font-size: 0.78rem;
}

/* ---------- filters ---------- */
.bst-leads-card {
    padding: 0;
    overflow: hidden;
}

.bst-leads-bar {
    display: grid;
    gap: 12px;
    padding: 14px 16px 13px;
    border-bottom: 1px solid var(--exh-line-soft);
    background: #fbfdfd;
}

.bst-leads-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.bst-leads-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    margin: 0;
    padding: 0 6px 0 12px;
    border: 1px solid var(--exh-line);
    border-radius: 999px;
    background: #fff;
    color: var(--exh-soft);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 650;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.bst .bst-leads-chip .exh-icon {
    width: 14px;
    height: 14px;
    margin-left: -3px;
}

.bst-leads-chip.is-hot .exh-icon { color: var(--lead-hot); }
.bst-leads-chip.is-warm .exh-icon { color: var(--lead-warm); }
.bst-leads-chip.is-cold .exh-icon { color: var(--lead-cold); }

.bst-leads-chip > span {
    min-width: 22px;
    padding: 2px 6px;
    border-radius: 999px;
    background: #eef4f3;
    color: var(--exh-soft);
    font-size: 0.7rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    text-align: center;
}

.bst-leads-chip:hover {
    border-color: #bfe0da;
    color: var(--exh-ink);
}

.bst-leads-chip.is-on {
    border-color: var(--exh-ink);
    background: var(--exh-ink);
    color: #fff;
}

.bst-leads-chip.is-on .exh-icon {
    color: #fff;
}

.bst-leads-chip.is-on > span {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
}

.bst-leads-chip:focus-visible,
.bst-lead-row:focus-visible,
.bst-rate-btn:focus-visible,
.bst-lead-link:focus-visible,
.bst-lead-ev-x:focus-visible {
    outline: none;
    box-shadow: var(--exh-ring);
}

.bst-leads-tools {
    display: flex;
    align-items: center;
    gap: 8px;
}

.bst-leads-search {
    position: relative;
    display: block;
    flex: 1;
    min-width: 0;
}

.bst .bst-leads-search .exh-icon {
    position: absolute;
    top: 50%;
    left: 12px;
    width: 15px;
    height: 15px;
    color: var(--exh-faint);
    transform: translateY(-50%);
    pointer-events: none;
}

.bst-leads-search .bst-input {
    height: 38px;
    padding-left: 34px;
    font-size: 0.86rem;
}

.bst-leads-search .bst-input::-webkit-search-cancel-button {
    -webkit-appearance: none;
}

.bst-leads-by {
    flex: none;
    width: auto;
    max-width: 150px;
    height: 38px;
    padding: 0 30px 0 12px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7f7c' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 14px;
    font-size: 0.84rem;
    cursor: pointer;
}

.bst-leads-export {
    flex: none;
    height: 38px;
}

.bst-leads-total {
    margin: 0;
    padding: 11px 18px 2px;
    color: var(--exh-muted);
    font-size: 0.74rem;
    font-weight: 650;
}

/* ---------- a lead ---------- */
.bst-leads-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.bst-ld {
    position: relative;
}

.bst-ld + .bst-ld {
    border-top: 1px solid var(--exh-line-soft);
}

/* The rating down the edge of the row */
.bst-ld::before {
    content: '';
    position: absolute;
    top: 10px;
    bottom: 10px;
    left: 0;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: transparent;
}

.bst-ld.is-hot::before { background: #f97316; }
.bst-ld.is-warm::before { background: #eab308; }
.bst-ld.is-cold::before { background: #60a5fa; }

.bst-lead-row {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto 18px;
    align-items: center;
    gap: 12px;
    width: 100%;
    margin: 0;
    padding: 13px 16px 13px 18px;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.18s ease;
    -webkit-tap-highlight-color: transparent;
}

.bst-lead-row:hover {
    background: #f8fbfa;
}

.bst-ld.is-open > .bst-lead-row {
    background: #f6faf9;
}

.bst-lead-avatar {
    position: relative;
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    overflow: hidden;
    border-radius: 50%;
    background: linear-gradient(135deg, #d8f2ec, #bfe6de);
    color: #0b5f56;
    font-size: 0.78rem;
    font-weight: 700;
}

.bst-lead-avatar img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.bst-lead-avatar--lg {
    width: 56px;
    height: 56px;
    font-size: 1rem;
}

.bst-lead-avatar--wait {
    background: #fff3e0;
    color: #a15c07;
}

.bst .bst-lead-avatar--wait .exh-icon {
    width: 22px;
    height: 22px;
}

.bst-lead-text {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.bst-lead-name {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
    color: var(--exh-ink);
    font-size: 0.92rem;
    font-weight: 650;
    line-height: 1.3;
}

.bst-lead-name > span:first-child {
    min-width: 0;
    overflow-wrap: anywhere;
}

.bst-lead-rate {
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: 4px;
    padding: 2px 8px 2px 6px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1.4;
}

.bst .bst-lead-rate .exh-icon {
    width: 12px;
    height: 12px;
}

.bst-lead-rate.is-hot { background: var(--lead-hot-bg); color: var(--lead-hot); }
.bst-lead-rate.is-warm { background: var(--lead-warm-bg); color: var(--lead-warm); }
.bst-lead-rate.is-cold { background: var(--lead-cold-bg); color: var(--lead-cold); }

.bst-lead-sub {
    overflow: hidden;
    color: var(--exh-muted);
    font-size: 0.82rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bst-lead-note {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin-top: 2px;
    color: var(--exh-body);
    font-size: 0.82rem;
    line-height: 1.4;
}

.bst .bst-lead-note .exh-icon {
    width: 13px;
    height: 13px;
    margin-top: 2px;
    color: var(--exh-faint);
}

.bst-lead-note > span {
    display: -webkit-box;
    min-width: 0;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
    overflow-wrap: anywhere;
}

.bst-ld.is-open .bst-lead-note {
    display: none;
}

.bst-lead-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.bst-lead-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px 2px 6px;
    border-radius: 999px;
    background: #eef4f3;
    color: var(--exh-soft);
    font-size: 0.7rem;
    font-weight: 650;
    line-height: 1.4;
}

.bst .bst-lead-tag .exh-icon {
    width: 12px;
    height: 12px;
}

.bst-lead-meta {
    align-self: start;
    padding-top: 2px;
    color: var(--exh-faint);
    font-size: 0.74rem;
    font-variant-numeric: tabular-nums;
    text-align: right;
    white-space: nowrap;
}

.bst-lead-chev {
    display: inline-flex;
    color: var(--exh-faint);
    transition: transform 0.22s ease;
}

.bst .bst-lead-chev .exh-icon {
    width: 18px;
    height: 18px;
}

.bst-ld.is-open .bst-lead-chev {
    transform: rotate(180deg);
}

/* ---------- a lead, open ---------- */
.bst-lead-detail {
    display: grid;
    gap: 16px;
    padding: 6px 18px 16px 72px;
    background: #f6faf9;
    animation: bstIn 0.2s ease both;
}

.bst-lead-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.bst-lead-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    max-width: 100%;
    height: 36px;
    padding: 0 14px 0 11px;
    border: 1px solid var(--exh-line);
    border-radius: 999px;
    background: #fff;
    color: var(--exh-deep);
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.bst-lead-link:hover {
    border-color: #9fd3ca;
    background: #f1faf8;
}

.bst .bst-lead-link .exh-icon {
    width: 15px;
    height: 15px;
}

.bst-lead-link span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bst-lead-nocontact {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin: 0;
    padding: 10px 12px;
    border-radius: 12px;
    background: #eaf2f0;
    color: var(--exh-soft);
    font-size: 0.82rem;
    line-height: 1.45;
}

.bst .bst-lead-nocontact .exh-icon {
    margin-top: 2px;
    color: var(--exh-deep);
}

.bst-lead-label,
.bst-sheet-label {
    margin: 0 0 8px;
    color: var(--exh-muted);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* Hot, warm, cold */
.bst-rate {
    display: inline-grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
}

.bst-rate-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 36px;
    margin: 0;
    padding: 0 16px 0 13px;
    border: 1.5px solid #dbe6e4;
    border-radius: 11px;
    background: #fff;
    color: var(--exh-soft);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 650;
    cursor: pointer;
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.12s ease;
    -webkit-tap-highlight-color: transparent;
}

.bst .bst-rate-btn .exh-icon {
    width: 15px;
    height: 15px;
}

.bst-rate-btn.is-hot .exh-icon { color: var(--lead-hot); }
.bst-rate-btn.is-warm .exh-icon { color: var(--lead-warm); }
.bst-rate-btn.is-cold .exh-icon { color: var(--lead-cold); }

.bst-rate-btn:hover:not(:disabled) {
    border-color: #c3d6d2;
    color: var(--exh-ink);
}

.bst-rate-btn:active:not(:disabled) {
    transform: scale(0.97);
}

.bst-rate-btn.is-hot.is-on { border-color: var(--lead-hot-line); background: var(--lead-hot-bg); color: var(--lead-hot); }
.bst-rate-btn.is-warm.is-on { border-color: var(--lead-warm-line); background: var(--lead-warm-bg); color: var(--lead-warm); }
.bst-rate-btn.is-cold.is-on { border-color: var(--lead-cold-line); background: var(--lead-cold-bg); color: var(--lead-cold); }

.bst-rate-btn:disabled {
    cursor: default;
    opacity: 0.7;
}

.bst-rate--lg {
    display: grid;
    gap: 8px;
}

.bst-rate--lg .bst-rate-btn {
    flex-direction: column;
    gap: 4px;
    height: 62px;
    padding: 0 8px;
    border-radius: 15px;
    font-size: 0.86rem;
}

.bst .bst-rate--lg .bst-rate-btn .exh-icon {
    width: 21px;
    height: 21px;
}

/* Notes */
.bst-lead-evs {
    display: grid;
    gap: 8px;
    margin: 0 0 10px;
    padding: 0;
    list-style: none;
}

.bst-lead-ev {
    padding: 9px 10px 10px 13px;
    border: 1px solid var(--exh-line-soft);
    border-radius: 12px;
    background: #fff;
}

.bst-lead-ev-head {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 26px;
    margin: 0;
    color: var(--exh-muted);
    font-size: 0.74rem;
}

.bst-lead-ev-head strong {
    color: var(--exh-ink);
    font-weight: 650;
}

.bst-lead-ev-x {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    margin: 0 0 0 auto;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: none;
    color: var(--exh-faint);
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.bst .bst-lead-ev-x .exh-icon {
    width: 14px;
    height: 14px;
}

.bst-lead-ev-x:hover:not(:disabled) {
    background: #fff4f2;
    color: #b42318;
}

.bst-lead-ev-text {
    margin: 1px 0 0;
    color: var(--exh-body);
    font-size: 0.86rem;
    line-height: 1.45;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.bst-lead-add {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 8px;
    margin: 0;
}

.bst-lead-add .bst-textarea {
    min-height: 44px;
    padding: 9px 13px;
    font-size: 0.86rem;
}

.bst-lead-add .bst-btn {
    height: 44px;
}

.bst-lead-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 12px;
    min-height: 30px;
    padding-top: 12px;
    border-top: 1px dashed #d5e3e0;
}

.bst-lead-facts {
    flex: 1;
    min-width: 0;
    color: var(--exh-muted);
    font-size: 0.74rem;
}

.bst-lead-ask {
    flex: 1 1 100%;
    color: #8a2c1f;
    font-size: 0.82rem;
    font-weight: 600;
}

.bst-lead-foot .bst-link--muted {
    font-size: 0.78rem;
}

.bst-leads-none {
    display: grid;
    justify-items: center;
    gap: 8px;
    padding: 44px 20px 48px;
    color: var(--exh-body);
    font-size: 0.88rem;
    text-align: center;
}

.bst-leads-none p {
    margin: 0;
}

.bst-leads-more {
    display: flex;
    margin: 12px auto 16px;
}

.bst-lead-skel {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    padding: 10px 0;
}

.bst-lead-skel .bst-skel--avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
}

.bst-lead-skel .bst-skel--line {
    margin-top: 0;
}

.bst-lead-skel .bst-skel--short {
    margin-top: 8px;
}

/* ---------- no leads yet ---------- */
.bst-leads-empty {
    padding: 38px 24px 34px;
    text-align: center;
}

.bst-leads-empty-art {
    display: inline-grid;
    place-items: center;
    width: 68px;
    height: 68px;
    border-radius: 22px;
    background: linear-gradient(135deg, #14b3a1 0%, #00796b 100%);
    box-shadow: 0 14px 28px -12px rgba(0, 121, 107, 0.6);
    color: #fff;
}

.bst .bst-leads-empty-art .exh-icon {
    width: 32px;
    height: 32px;
}

.bst-leads-empty h3 {
    margin: 18px 0 6px;
    color: var(--exh-ink);
    font-family: inherit;
    font-size: 1.12rem;
    font-weight: 700;
}

.bst-leads-empty > p {
    max-width: 430px;
    margin: 0 auto;
    color: var(--exh-muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

.bst-leads-steps {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    max-width: 660px;
    margin: 24px auto;
    padding: 0;
    list-style: none;
    text-align: left;
}

.bst-leads-steps li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 13px 13px;
    border: 1px solid var(--exh-line);
    border-radius: 14px;
    background: #fbfdfd;
}

.bst-leads-steps li > span {
    display: inline-grid;
    flex: none;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--exh-wash);
    color: var(--exh-deep);
    font-size: 0.74rem;
    font-weight: 700;
}

.bst-leads-steps p {
    margin: 0;
    color: var(--exh-muted);
    font-size: 0.78rem;
    line-height: 1.4;
}

.bst-leads-steps strong {
    display: block;
    margin-bottom: 2px;
    color: var(--exh-ink);
    font-size: 0.84rem;
    font-weight: 650;
}

/* ---------- the scanner ---------- */
.bst-scan {
    position: absolute;
    inset: 0;
    z-index: 6;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(4, 16, 15, 0.74);
    opacity: 0;
    transition: opacity 0.22s ease;
}

.bst-scan.is-open {
    opacity: 1;
}

.bst-scan-box {
    position: relative;
    width: min(430px, 100%);
    height: min(780px, 100%);
    overflow: hidden;
    border-radius: 28px;
    background: var(--scan-ink);
    box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.06);
    color: #fff;
    transform: translateY(14px) scale(0.98);
    transition: transform 0.36s cubic-bezier(0.16, 1, 0.3, 1);
}

.bst-scan.is-open .bst-scan-box {
    transform: none;
}

.bst-scan-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: var(--scan-ink);
    transition: filter 0.3s ease;
}

.bst-scan-top {
    position: absolute;
    inset: 0 0 auto;
    z-index: 3;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    align-items: center;
    gap: 8px;
    padding: max(14px, env(safe-area-inset-top)) 14px 30px;
    background: linear-gradient(180deg, rgba(3, 14, 13, 0.78), rgba(3, 14, 13, 0));
}

.bst-scan-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 650;
    text-align: center;
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.4);
}

.bst-scan-round {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.bst-scan-round[hidden] {
    display: none;
}

.bst .bst-scan-round .exh-icon {
    width: 20px;
    height: 20px;
}

.bst-scan-round:hover {
    background: rgba(255, 255, 255, 0.26);
}

.bst-scan-round[aria-pressed='true'] {
    background: #fff;
    color: var(--exh-ink);
}

.bst-scan-round:focus-visible,
.bst-scan-type:focus-visible {
    outline: 2px solid #5eead4;
    outline-offset: 2px;
}

/* The viewfinder: everything outside it is dimmed by its shadow */
.bst-scan-aim {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 20px;
    padding: 0 20px 14%;
    transition: opacity 0.2s ease;
}

.bst-scan-frame {
    position: relative;
    width: min(70%, 290px);
    aspect-ratio: 1;
    border-radius: 30px;
    box-shadow: 0 0 0 100vmax rgba(3, 14, 13, 0.52);
}

.bst-scan-frame i {
    position: absolute;
    width: 38px;
    height: 38px;
    border: 4px solid #fff;
    transition: border-color 0.2s ease;
}

.bst-scan-frame i:nth-child(1) { top: -2px; left: -2px; border-right: 0; border-bottom: 0; border-radius: 30px 0 0 0; }
.bst-scan-frame i:nth-child(2) { top: -2px; right: -2px; border-bottom: 0; border-left: 0; border-radius: 0 30px 0 0; }
.bst-scan-frame i:nth-child(3) { right: -2px; bottom: -2px; border-top: 0; border-left: 0; border-radius: 0 0 30px 0; }
.bst-scan-frame i:nth-child(4) { bottom: -2px; left: -2px; border-top: 0; border-right: 0; border-radius: 0 0 0 30px; }

.bst-scan-line {
    position: absolute;
    top: 12%;
    right: 9%;
    left: 9%;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, rgba(94, 234, 212, 0), #5eead4 30%, #5eead4 70%, rgba(94, 234, 212, 0));
    box-shadow: 0 0 16px 1px rgba(45, 212, 191, 0.8);
    animation: bstScanLine 2.6s ease-in-out infinite;
}

@keyframes bstScanLine {
    0%, 100% { top: 12%; }
    50% { top: 88%; }
}

.bst-scan.is-hit .bst-scan-frame i {
    border-color: #34d399;
}

.bst-scan.is-hit .bst-scan-frame {
    animation: bstScanHit 0.42s cubic-bezier(0.2, 0.9, 0.3, 1.3);
}

@keyframes bstScanHit {
    40% { transform: scale(0.95); }
}

.bst-scan-hint {
    position: relative;
    max-width: 300px;
    margin: 0;
    padding: 9px 16px;
    border-radius: 18px;
    background: rgba(3, 14, 13, 0.66);
    color: #fff;
    font-size: 0.84rem;
    line-height: 1.4;
    text-align: center;
}

.bst-scan-hint strong {
    font-weight: 650;
}

.bst-scan-hint.is-ok {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #e3f6f1;
    color: #0b5f56;
    font-weight: 600;
    text-align: left;
}

.bst .bst-scan-hint.is-ok .exh-icon {
    width: 15px;
    height: 15px;
}

.bst-scan-hint.is-warn {
    background: #fff3e0;
    color: #7a3d00;
    font-weight: 600;
    animation: bstScanNudge 0.4s ease;
}

@keyframes bstScanNudge {
    25% { transform: translateX(-5px); }
    60% { transform: translateX(4px); }
}

.bst-scan-bottom {
    position: absolute;
    inset: auto 0 0;
    z-index: 3;
    display: grid;
    justify-items: center;
    gap: 8px;
    padding: 34px 16px max(18px, env(safe-area-inset-bottom));
    background: linear-gradient(0deg, rgba(3, 14, 13, 0.82), rgba(3, 14, 13, 0));
    transition: opacity 0.2s ease;
}

.bst-scan-count {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    min-height: 26px;
    margin: 0;
}

.bst-scan-count span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 11px 4px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    font-size: 0.76rem;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
}

.bst-scan-count span.is-wait {
    background: #fff3e0;
    color: #7a3d00;
}

.bst .bst-scan-count .exh-icon {
    width: 13px;
    height: 13px;
}

.bst-scan-type {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 40px;
    margin: 0;
    padding: 0 12px;
    border: 0;
    border-radius: 999px;
    background: none;
    color: rgba(255, 255, 255, 0.86);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
}

.bst-scan-type[hidden],
.bst-scan-form[hidden] {
    display: none;
}

.bst-scan-type:hover {
    color: #fff;
}

.bst-scan-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    width: 100%;
    margin: 0;
}

.bst-scan-form .bst-input {
    border-color: transparent;
}

.bst-scan-form .bst-btn {
    height: 44px;
    padding: 0 18px;
    font-size: 0.88rem;
}

/* Starting, blocked, no camera */
.bst-scan-state {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 8px;
    padding: 80px 28px 170px;
    background: var(--scan-ink);
    text-align: center;
}

.bst-scan-state[hidden] {
    display: none;
}

.bst-scan-state-art {
    display: inline-grid;
    place-items: center;
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: #9fe9dc;
}

.bst .bst-scan-state-art .exh-icon {
    width: 27px;
    height: 27px;
}

.bst-scan-state-art .bst-spinner {
    width: 24px;
    height: 24px;
    border-width: 2.5px;
}

.bst-scan-state-title {
    margin: 8px 0 0;
    font-size: 1.04rem;
    font-weight: 650;
}

.bst-scan-state-text {
    max-width: 300px;
    margin: 0 0 8px;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.86rem;
    line-height: 1.5;
}

.bst-scan-state .bst-btn--ghost {
    border-color: rgba(255, 255, 255, 0.4);
    background: transparent;
    color: #fff;
}

.bst-scan-state .bst-btn--ghost:hover:not(:disabled) {
    border-color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.bst-scan:not([data-cam='live']) .bst-scan-aim {
    opacity: 0;
}

/* ---------- the visitor just scanned ---------- */
.bst-scan-sheet {
    position: absolute;
    /* --bst-kb: the height of the on-screen keyboard over the page (js/booth-leads.js) */
    inset: auto 0 var(--bst-kb, 0px);
    z-index: 5;
    max-height: calc(90% - var(--bst-kb, 0px));
    overflow: auto;
    padding: 10px 18px max(18px, env(safe-area-inset-bottom));
    border-radius: 26px 26px 0 0;
    background: #fff;
    box-shadow: 0 -22px 48px -20px rgba(0, 0, 0, 0.55);
    color: var(--exh-body);
    transform: translateY(104%);
    transition: transform 0.36s cubic-bezier(0.16, 1, 0.3, 1);
    overscroll-behavior: contain;
}

.bst-scan-sheet[hidden] {
    display: none;
}

.bst-scan.has-sheet .bst-scan-sheet {
    transform: none;
}

.bst-scan.has-sheet .bst-scan-aim,
.bst-scan.has-sheet .bst-scan-bottom {
    opacity: 0;
    pointer-events: none;
}

.bst-scan.has-sheet .bst-scan-video {
    filter: brightness(0.5) saturate(0.8);
}

.bst-sheet-grab {
    display: block;
    width: 38px;
    height: 4px;
    margin: 0 auto 14px;
    border-radius: 4px;
    background: #d8e3e1;
}

.bst-sheet-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 11px 4px 8px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 700;
    line-height: 1.4;
}

.bst .bst-sheet-pill .exh-icon {
    width: 13px;
    height: 13px;
}

.bst-sheet-pill .bst-spinner {
    width: 11px;
    height: 11px;
}

.bst-sheet-pill.is-new { background: #e3f6f1; color: #0b6f64; }
.bst-sheet-pill.is-back { background: #eceffe; color: #3b4cb8; }
.bst-sheet-pill.is-wait { background: #fff3e0; color: #7a3d00; }
.bst-sheet-pill.is-saving { background: #eef4f3; color: var(--exh-soft); }

.bst-sheet-who {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 56px;
    margin: 12px 0 18px;
}

.bst-sheet-who .bst-skel--avatar {
    flex: none;
    width: 56px;
    height: 56px;
    border-radius: 50%;
}

.bst-sheet-who-text {
    flex: 1;
    min-width: 0;
}

.bst-sheet-who-text .bst-skel--line {
    width: 62%;
    height: 16px;
    margin-top: 0;
}

.bst-sheet-who-text .bst-skel--short {
    width: 44%;
    margin-top: 10px;
}

.bst-sheet-name {
    margin: 0;
    color: var(--exh-ink);
    font-size: 1.14rem;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.01em;
    overflow-wrap: anywhere;
}

.bst-sheet-sub {
    margin: 2px 0 0;
    color: var(--exh-muted);
    font-size: 0.86rem;
    line-height: 1.4;
}

.bst-sheet-contact {
    margin: 3px 0 0;
    color: var(--exh-faint);
    font-size: 0.78rem;
    overflow-wrap: anywhere;
}

.bst-sheet-note {
    min-height: 68px;
    margin-top: 12px;
}

.bst-sheet-earlier {
    display: grid;
    gap: 6px;
    margin: 12px 0 0;
    padding: 0;
    color: var(--exh-muted);
    font-size: 0.74rem;
    list-style: none;
}

.bst-sheet-earlier:empty {
    display: none;
}

.bst-sheet-earlier li {
    padding: 8px 12px 9px;
    border-radius: 12px;
    background: #f4f8f7;
}

.bst-sheet-earlier strong {
    color: var(--exh-ink);
    font-weight: 650;
}

.bst-sheet-earlier span {
    display: block;
    margin-top: 2px;
    color: var(--exh-body);
    font-size: 0.84rem;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.bst-sheet-actions {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
    margin-top: 16px;
}

.bst-sheet-actions .bst-btn {
    height: 50px;
    font-size: 0.94rem;
}

.bst .bst-sheet-actions .exh-icon {
    width: 18px;
    height: 18px;
}

/* ---------- small screens ---------- */
@media (max-width: 760px) {
    /* Six views: the icon over its name, so every name fits */
    .bst-views {
        gap: 0;
        border-radius: 17px;
    }

    .bst-view {
        position: relative;
        flex: 1 1 0;
        flex-direction: column;
        gap: 3px;
        min-width: 0;
        height: 48px;
        padding: 0 2px;
        border-radius: 14px;
        font-size: 0.66rem;
        letter-spacing: -0.005em;
    }

    .bst .bst-view .exh-icon {
        width: 17px;
        height: 17px;
    }

    .bst-view .bst-view-badge {
        position: absolute;
        top: 3px;
        left: calc(50% + 5px);
        min-width: 16px;
        height: 16px;
        margin: 0;
        padding: 0 4px;
        font-size: 0.62rem;
        box-shadow: 0 0 0 2px #eef4f3;
    }

    .bst-leads-head .bst-leads-scan {
        display: none;
    }

    /* The scan button stays under the thumb */
    .bst-leads-dock {
        position: sticky;
        bottom: 0;
        z-index: 2;
        display: block;
        margin: auto -14px -24px;
        padding: 18px 14px max(14px, env(safe-area-inset-bottom));
        background: linear-gradient(180deg, rgba(244, 248, 247, 0), #f4f8f7 34%);
    }

    .bst-leads-dock .bst-btn {
        height: 52px;
        font-size: 0.96rem;
    }

    .bst-leads.is-empty .bst-leads-dock {
        display: none;
    }

    .bst-leads-fine {
        margin-bottom: 8px;
    }

    .bst-leads-card {
        padding: 0;
    }

    .bst-leads-bar {
        padding: 12px 12px 11px;
    }

    .bst-leads-chips {
        flex-wrap: nowrap;
        margin: 0 -12px;
        padding: 0 12px;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .bst-leads-chips::-webkit-scrollbar {
        display: none;
    }

    .bst-leads-chip {
        flex: none;
        height: 34px;
    }

    .bst-leads-tools {
        flex-wrap: wrap;
    }

    .bst-leads-search {
        flex: 1 1 100%;
    }

    .bst-leads-search .bst-input,
    .bst-leads-by,
    .bst-leads-export {
        height: 42px;
        font-size: 16px;
    }

    .bst-leads-by {
        flex: 1;
        max-width: none;
    }

    .bst-leads-export {
        flex: 1;
        font-size: 0.86rem;
    }

    .bst-leads-total {
        padding: 10px 14px 0;
    }

    .bst-lead-row {
        grid-template-columns: 40px minmax(0, 1fr) 18px;
        gap: 11px;
        padding: 13px 12px 13px 14px;
    }

    .bst-lead-avatar {
        width: 40px;
        height: 40px;
    }

    .bst-lead-avatar--lg {
        width: 56px;
        height: 56px;
    }

    /* When and by whom goes under the name */
    .bst-lead-meta {
        grid-column: 2;
        grid-row: 2;
        padding: 0;
        text-align: left;
    }

    .bst-lead-chev {
        grid-column: 3;
        grid-row: 1;
    }

    .bst-lead-detail {
        padding: 4px 14px 16px;
    }

    .bst-lead-add {
        grid-template-columns: minmax(0, 1fr);
    }

    .bst-lead-add .bst-textarea,
    .bst-sheet-note,
    .bst-scan-form .bst-input {
        font-size: 16px;
    }

    .bst-rate:not(.bst-rate--lg) {
        display: grid;
    }

    .bst-rate:not(.bst-rate--lg) .bst-rate-btn {
        height: 42px;
        padding: 0 8px;
    }

    .bst-leads-empty {
        padding: 30px 16px 24px;
    }

    .bst-leads-steps {
        grid-template-columns: minmax(0, 1fr);
        margin: 20px 0;
    }

    .bst-leads-empty .bst-btn {
        width: 100%;
        height: 52px;
        font-size: 0.96rem;
    }

    /* The scanner fills the phone */
    .bst-scan {
        padding: 0;
        background: var(--scan-ink);
    }

    .bst-scan-box {
        width: 100%;
        height: 100%;
        border-radius: 0;
        box-shadow: none;
        transform: translateY(26px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .bst-scan,
    .bst-scan-box,
    .bst-scan-sheet,
    .bst-scan-video,
    .bst-lead-chev {
        transition: none;
    }

    .bst-scan-line,
    .bst-scan.is-hit .bst-scan-frame,
    .bst-scan-hint.is-warn,
    .bst-lead-detail,
    .bst-leads-note {
        animation: none;
    }

    .bst-scan-line {
        top: 50%;
    }
}
