/* ==========================================================================
   QuickReach — floating reach-anyone widget (launcher + panel)
   Composes only from app.css tokens. z-index sits under the FreJun dialer
   (1200) so a live call always outranks the launcher.
   ========================================================================== */

.qr-launcher {
    position: fixed;
    right: 20px;
    bottom: 84px; /* clear of the WhatsApp dock's pill strip */
    z-index: 1190;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg-primary);
    color: var(--color-gray-600);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-lg);
    cursor: grab;
    transition: box-shadow var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
    touch-action: none; /* pointer-drag owns the gesture */
}
.qr-launcher:hover { color: var(--color-primary); box-shadow: var(--shadow-xl); }
.qr-launcher:active { cursor: grabbing; transform: scale(0.95); }
.qr-launcher:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.qr-launcher.is-open { color: var(--color-primary); border-color: var(--color-primary); }
.qr-launcher svg { width: 24px; height: 24px; }

.qr-panel {
    position: fixed;
    z-index: 1190;
    width: min(320px, calc(100vw - 16px));
    display: none;
    flex-direction: column;
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-2xl);
    overflow: hidden;
}
.qr-panel.is-open { display: flex; }

/* First-open education card — dismissed once, gone forever */
.qr-intro {
    padding: 14px 16px 12px;
    background: var(--color-bg-secondary);
    border-bottom: 1px solid var(--color-border);
}
.qr-intro-title {
    margin: 0 0 4px;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-primary);
}
.qr-intro-text {
    margin: 0 0 10px;
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--color-gray-600);
}
.qr-intro-got {
    border: none;
    background: none;
    padding: 4px 10px;
    margin-left: -10px;
    border-radius: var(--radius-md);
    font-size: 12.5px;
    font-weight: 600;
    color: var(--color-primary);
    cursor: pointer;
}
.qr-intro-got:hover { background: var(--color-gray-100); }
.qr-intro-got:focus-visible { outline: none; box-shadow: var(--shadow-focus); }

/* Channel switcher — one segment active as a raised pill */
.qr-tabs {
    display: flex;
    gap: 2px;
    padding: 6px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg-secondary);
}
.qr-tab {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 0;
    border: none;
    background: none;
    border-radius: var(--radius-md);
    font-size: 12.5px;
    font-weight: 500;
    color: var(--color-gray-500);
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast);
}
.qr-tab svg { width: 14px; height: 14px; }
.qr-tab:hover { background: var(--color-gray-100); color: var(--color-gray-700); }
.qr-tab[aria-selected="true"] {
    background: var(--color-bg-primary);
    color: var(--color-primary);
    box-shadow: var(--shadow-xs);
}
.qr-tab:focus-visible { outline: none; box-shadow: var(--shadow-focus); }

.qr-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-gray-400);
    cursor: text;
}
.qr-search svg { width: 15px; height: 15px; flex: none; }
.qr-input {
    flex: 1;
    border: none;
    outline: none;
    background: none;
    font-size: 14px;
    color: var(--color-text-primary);
}
.qr-input::placeholder { color: var(--color-gray-400); }

.qr-results {
    min-height: 120px; /* idle → loading → results never resizes the panel */
    max-height: 300px;
    overflow-y: auto;
    padding: 6px;
}
.qr-label {
    padding: 6px 8px 2px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--color-gray-500);
}
.qr-row {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border: none;
    background: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-align: left;
    user-select: none;
}
.qr-row:hover,
.qr-row.is-selected { background: var(--color-bg-secondary); }
.qr-row:focus-visible { outline: none; box-shadow: var(--shadow-focus); }

.qr-avatar {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-full);
    background: var(--color-gray-100);
    color: var(--color-gray-600);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex: none;
}
.qr-avatar.is-action { background: var(--color-primary-light); color: var(--color-primary); }
.qr-avatar svg { width: 15px; height: 15px; }

.qr-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.qr-row-name {
    font-size: 13.5px;
    font-weight: 500;
    color: var(--color-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.qr-row-sub {
    font-size: 12px;
    color: var(--color-gray-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.qr-row-go { flex: none; color: var(--color-gray-400); opacity: 0; transition: opacity var(--transition-fast); }
.qr-row:hover .qr-row-go,
.qr-row.is-selected .qr-row-go { opacity: 1; }
.qr-row-go svg { width: 14px; height: 14px; }

.qr-row-time {
    flex: none;
    font-size: 11.5px;
    color: var(--color-gray-500);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.qr-row-copy {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: none;
    background: none;
    border-radius: var(--radius-sm);
    color: var(--color-gray-400);
    cursor: pointer;
    opacity: 0;
    transition: opacity var(--transition-fast), background var(--transition-fast);
}
.qr-row:hover .qr-row-copy,
.qr-row.is-selected .qr-row-copy,
.qr-row-copy:focus-visible { opacity: 1; }
.qr-row-copy:hover { background: var(--color-gray-100); color: var(--color-gray-600); }
.qr-row-copy:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.qr-row-copy svg { width: 13px; height: 13px; }

.qr-hint {
    padding: 22px 16px;
    text-align: center;
    font-size: 13px;
    color: var(--color-gray-500);
}
.qr-retry {
    border: none;
    background: none;
    padding: 0;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-primary);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.qr-retry:focus-visible { outline: none; box-shadow: var(--shadow-focus); border-radius: var(--radius-sm); }

.qr-foot {
    padding: 7px 12px;
    border-top: 1px solid var(--color-border);
    background: var(--color-bg-secondary);
    font-size: 11px;
    color: var(--color-gray-500);
    text-align: center;
}

/* Screen-reader-only live region */
.qr-live {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* Row-shaped skeletons at the real row height — the panel never resizes */
.qr-skel { display: flex; align-items: center; gap: 10px; padding: 8px; }
.qr-skel::before {
    content: '';
    width: 30px;
    height: 30px;
    border-radius: var(--radius-full);
    background: var(--color-gray-100);
    flex: none;
}
.qr-skel::after {
    content: '';
    height: 10px;
    flex: 1;
    border-radius: var(--radius-sm);
    background: var(--color-gray-100);
}
@media (prefers-reduced-motion: no-preference) {
    .qr-skel::before,
    .qr-skel::after { animation: qr-pulse 1.2s ease-in-out infinite; }
}
@keyframes qr-pulse { 50% { opacity: 0.55; } }
