/* ── Leads Panel ──────────────────────────────────────── */
:root {
    --lp-primary:  var(--accent);
    --lp-primary2: var(--accent-d);
    --lp-dark:     #0f172a;
    --lp-dark2:    var(--accent-deep);
    --lp-green:    #10b981;
    --lp-red:      #ef4444;
    --lp-amber:    #f59e0b;
    --lp-cyan:     #06b6d4;
    --lp-bg:       #f1f5f9;
    --lp-card:     #ffffff;
    --lp-border:   #e2e8f0;
    --lp-text:     #1e293b;
    --lp-muted:    #64748b;
    --lp-subtle:   #94a3b8;
    --lp-radius:   12px;
}

/* ── Wrapper ─────────────────────────────────────────── */
.content-wrapper:has(.lp-wrapper) { background: var(--lp-bg) !important; }
.lp-wrapper {
    margin: -10px -15px 0;
    padding: 0 0 48px;
    background: var(--lp-bg);
    
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
.lp-wrapper *, .lp-wrapper *::before, .lp-wrapper *::after { box-sizing: border-box; }

/* ── Header ─────────────────────────────────────────── */
.lp-header {
    /* Part of the page, not a card on it: no fill, no edge, no shadow. */
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    margin: 0 0 10px;
    padding: 14px 0 6px;
    position: relative;
}
.lp-header-inner {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 18px;
    max-width: 1400px;
    margin: 0 auto;
}
.lp-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #94a3b8;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.lp-breadcrumb a {
    color: #94a3b8;
    text-decoration: none;
    transition: color .2s;
}
.lp-breadcrumb a:hover { color: var(--lp-primary); }
.lp-bc-active { color: #475569; }
.lp-title {
    font-size: 24px;
    font-weight: var(--f-w-bold, 600);
    color: #1e293b;
    margin: 0 0 4px;
    letter-spacing: -.3px;
}
.lp-subtitle {
    font-size: 13px;
    color: #64748b;
    margin: 0;
}

/* ── Header action buttons ──────────────────────────── */
.lp-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    align-self: center;
}
.lp-header-btn {
    height: 40px;
    padding: 0 18px;
    border-radius: 9px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #1e293b;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all .2s;
    white-space: nowrap;
    text-decoration: none;
}
.lp-header-btn:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #1e293b;
}
.lp-header-btn--primary {
    background: linear-gradient(135deg, var(--lp-primary), var(--lp-primary2));
    border-color: transparent;
    color: #fff;
    box-shadow: 0 2px 8px rgb(var(--accent-rgb) / .30);
}
.lp-header-btn--primary:hover {
    box-shadow: 0 4px 14px rgb(var(--accent-rgb) / .42);
    transform: translateY(-1px);
    background: linear-gradient(135deg, var(--accent-d), #155e75);
    color: #fff;
}
.lp-header-btn--success {
    background: linear-gradient(135deg, #10b981, #059669);
    border-color: transparent;
    box-shadow: 0 4px 14px rgba(16,185,129,.4);
}
.lp-header-btn--success:hover {
    box-shadow: 0 6px 20px rgba(16,185,129,.5);
    transform: translateY(-1px);
    color: #fff;
}

/* ── KPI strip ───────────────────────────────────────── */
.lp-kpi-row {
    max-width: 1400px;
    margin: 0 auto 16px;
    padding: 0 24px;
    position: relative;
    z-index: 2;
}
.lp-kpi-track {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}
.lp-kpi {
    background: var(--lp-card);
    border: 1px solid var(--lp-border);
    border-radius: var(--lp-radius);
    padding: 14px 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
    position: relative;
    overflow: hidden;
    transition: transform .2s, box-shadow .2s;
}
.lp-kpi:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,.08);
}
.lp-kpi--total {
    background: linear-gradient(135deg, var(--lp-primary) 0%, var(--lp-primary2) 100%);
    border-color: transparent;
    color: #fff;
}
.lp-kpi--total .lp-kpi-label { color: rgba(255,255,255,.75); }
.lp-kpi--total .lp-kpi-num   { color: #fff; }
.lp-kpi-label {
    font-size: 11px;
    font-weight: var(--f-w-semi, 500);
    color: var(--lp-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin: 0 0 6px;
}
.lp-kpi-num {
    font-size: 22px;
    font-weight: var(--f-w-bold, 600);
    color: var(--lp-text);
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
}
.lp-kpi-pct {
    font-size: 11px;
    font-weight: var(--f-w-semi, 500);
    color: var(--lp-green);
    margin-left: 6px;
}
.lp-kpi-icon {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: rgb(var(--accent-rgb) / .1);
    color: var(--lp-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}
.lp-kpi--total .lp-kpi-icon {
    background: rgba(255,255,255,.18);
    color: #fff;
}

/* ── Toolbar (download / reset / search) ────────────── */
.lp-toolbar {
    max-width: 1400px;
    margin: 22px auto 14px;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}
.lp-toolbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
.lp-toolbar-title {
    font-size: 16px;
    font-weight: var(--f-w-semi, 500);
    color: var(--lp-text);
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.lp-toolbar-title i { color: var(--lp-primary); }
.lp-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    background: rgb(var(--accent-rgb) / .1);
    color: var(--lp-primary);
    font-size: 11px;
    font-weight: var(--f-w-semi, 500);
    border-radius: 100px;
}
.lp-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.lp-btn {
    height: 38px;
    padding: 0 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all .2s;
    border: 1px solid transparent;
    text-decoration: none;
    white-space: nowrap;
}
.lp-btn--primary {
    background: linear-gradient(135deg, var(--lp-primary), var(--lp-primary2));
    color: #fff;
    box-shadow: 0 2px 8px rgb(var(--accent-rgb) / .3);
}
.lp-btn--primary:hover {
    box-shadow: 0 4px 16px rgb(var(--accent-rgb) / .45);
    transform: translateY(-1px);
    color: #fff;
}
.lp-btn--success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    box-shadow: 0 2px 8px rgba(16,185,129,.3);
    border: none;
}
.lp-btn--success:hover {
    box-shadow: 0 4px 16px rgba(16,185,129,.45);
    transform: translateY(-1px);
    color: #fff;
}
.lp-btn--ghost {
    background: #fff;
    border: 1px solid var(--lp-border);
    color: var(--lp-muted);
}
.lp-btn--ghost:hover {
    border-color: var(--lp-primary);
    color: var(--lp-primary);
    background: rgb(var(--accent-rgb) / .05);
}
.lp-msg {
    flex: 1 1 100%;
    color: var(--lp-green);
    font-size: 13px;
    font-weight: 500;
    margin: 0;
    text-align: right;
}

/* ── Table Card ─────────────────────────────────────── */
.lp-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}
.lp-card {
    background: var(--lp-card);
    border-radius: var(--lp-radius);
    border: 1px solid var(--lp-border);
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
    overflow: hidden;
}
.lp-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: #fff;
    border-bottom: 1px solid #eef1f5;
}
.lp-card-title {
    font-size: 14px;
    font-weight: var(--f-w-semi, 500);
    color: #1e293b;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.lp-card-title i {
    color: var(--lp-primary);
    font-size: 15px;
}
.lp-card-badge {
    background: rgb(var(--accent-rgb) / .12);
    color: var(--accent-d);
    font-size: 11px;
    padding: 2px 10px;
    border-radius: 100px;
    font-weight: 500;
}

/* ── Table ──────────────────────────────────────────── */
/*
 | Sideways only.
 |
 | The table used to scroll inside its own fixed-height box with a sticky
 | header riding on top. Two scrollbars on one screen — the page's and the
 | table's — and rows that could only be reached by finding the inner one.
 | The page scrolls normally now and the rows come a page at a time from the
 | paginator, so there is nothing left to scroll vertically in here.
 |
 | overflow-x stays: a wide table still has to move sideways rather than push
 | the whole page out. With no max-height the box grows to its content, so the
 | vertical scrollbar never appears even though the computed overflow-y is
 | auto (CSS will not let one axis be visible while the other is not).
 */
.lp-table-wrap {
    overflow-x: auto;
}
.lp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.lp-table thead th {
    /* Not sticky: it scrolls away with the page like any other heading. */
    background: var(--accent-deep);
    color: #fff;
    font-size: 11.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    padding: 12px 16px;
    text-align: left;
    /* An inset shadow, not a border: with border-collapse the header's own
       border belongs to the table grid and scrolls away underneath a sticky
       cell, leaving the rows running into the header. */
    box-shadow: none;
    white-space: nowrap;
}
.lp-table thead th:first-child { border-top-left-radius: 10px; }
.lp-table thead th:last-child  { border-top-right-radius: 10px; }
.lp-table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid #f1f5f9;
    color: var(--lp-text);
    vertical-align: middle;
}
.lp-table tbody tr:hover {
    background: rgb(var(--accent-rgb) / .04);
}
.lp-table tbody tr:last-child td {
    border-bottom: none;
}
.lp-name {
    font-weight: var(--f-w-semi, 500);
    color: var(--lp-text);
}
.lp-mobile {
    font-size: 12px;
    color: var(--lp-muted);
    font-weight: 500;
}
.lp-mono {
    color: var(--lp-muted);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.lp-source-tag {
    display: inline-block;
    padding: 2px 8px;
    background: rgb(var(--accent-rgb) / .08);
    color: var(--lp-primary);
    border-radius: 6px;
    font-size: 11px;
    font-weight: var(--f-w-semi, 500);
    text-transform: uppercase;
    letter-spacing: .03em;
}
.lp-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: var(--f-w-semi, 500);
    text-transform: capitalize;
    background: rgb(var(--accent-rgb) / .1);
    color: var(--lp-primary);
}
.lp-status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}
.lp-status--fresh        { background: rgb(var(--accent-rgb) / .1);  color: var(--accent); }
.lp-status--interested   { background: rgba(16,185,129,.1);  color: #10b981; }
.lp-status--closed       { background: rgba(34,197,94,.1);   color: #22c55e; }
.lp-status--not          { background: rgba(239,68,68,.1);   color: #ef4444; }
.lp-status--busy         { background: rgba(245,158,11,.1);  color: #f59e0b; }
.lp-status--later        { background: rgba(249,115,22,.1);  color: #f97316; }
.lp-status--progress     { background: rgba(6,182,212,.1);   color: #06b6d4; }
.lp-status--wrong        { background: rgba(14,116,144,.1);  color: #8b5cf6; }
.lp-empty {
    text-align: center;
    padding: 40px 16px;
    color: var(--lp-muted);
    font-size: 13px;
}
.lp-empty i {
    display: block;
    font-size: 28px;
    color: var(--lp-border);
    margin-bottom: 10px;
}

/* ── Pagination ─────────────────────────────────────── */
.lp-pagination {
    padding: 12px 20px;
    border-top: 1px solid var(--lp-border);
    background: #fcfcfd;
}
/* Count on the left, row-size buttons next to it, page links pushed right.
   Wraps rather than overflowing, so a narrow window stacks them instead of
   growing a sideways scrollbar under the table. */
.lp-pager {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 16px;
}
.lp-pager-count {
    font-size: 12.5px;
    color: var(--lp-muted);
}
.lp-pager-count b { color: var(--lp-text); font-weight: var(--f-w-semi, 500); }

.lp-pager-sizes { display: inline-flex; align-items: center; gap: 4px; }
.lp-pager-label {
    font-size: 10.5px;
    font-weight: var(--f-w-bold, 600);
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--lp-subtle);
    margin-right: 2px;
}
.lp-pager-size {
    min-width: 30px;
    padding: 4px 9px;
    border: 1px solid var(--lp-border);
    border-radius: 8px;
    background: #fff;
    color: var(--lp-muted);
    font-size: 12.5px;
    font-weight: var(--f-w-semi, 500);
    text-align: center;
    text-decoration: none;
}
.lp-pager-select {
    margin-left: 6px; padding: 4px 26px 4px 10px; border: 1px solid #e2e8f0; border-radius: 8px;
    background: #fff; color: #334155; font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.lp-pager-select:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px rgb(var(--accent-rgb) / .15); }
.lp-pager-size:hover { background: rgb(var(--accent-rgb) / .08); color: var(--lp-primary); }
.lp-pager-size.is-on {
    background: var(--lp-primary);
    border-color: var(--lp-primary);
    color: #fff;
}

.lp-pager-links { margin-left: auto; }

.lp-pagination .pagination {
    margin: 0;
    justify-content: flex-end;
    gap: 4px;
}
.lp-pagination .page-item .page-link {
    border-radius: 8px;
    border: 1px solid var(--lp-border);
    color: var(--lp-muted);
    padding: 6px 12px;
    font-size: 13px;
    background: #fff;
}
.lp-pagination .page-item.active .page-link {
    background: var(--lp-primary);
    border-color: var(--lp-primary);
    color: #fff;
}
.lp-pagination .page-item .page-link:hover {
    background: rgb(var(--accent-rgb) / .08);
    color: var(--lp-primary);
}

/* ── Alert ──────────────────────────────────────────── */
.lp-alert {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 12px 16px;
    color: #991b1b;
    font-size: 13px;
    margin: 16px 24px 0;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
}
.lp-alert--success {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #166534;
}

/* ── Leads table row ─────────────────────────────────── */
.lp-table--leads tbody tr { transition: background .12s; }
.lp-table--leads tbody td { padding: 12px 16px; }
.lp-table--leads thead th { background: #fff; border-bottom: 1px solid var(--lp-border); }
.lp-th-action { width: 1%; }

.lp-lead-cell { display: flex; align-items: center; gap: 11px; }
.lp-avatar {
    width: 34px; height: 34px;
    flex-shrink: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-d));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: var(--f-w-bold, 600);
}
.lp-lead-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.lp-lead-text .lp-name { font-size: 13px; line-height: 1.3; }
.lp-lead-text .lp-mobile { font-size: 11.5px; font-variant-numeric: tabular-nums; }

.lp-reveal { cursor: pointer; border-bottom: 1px dashed var(--lp-subtle); align-self: flex-start; }
.lp-reveal.is-open { border-bottom: 0; color: var(--lp-text); font-weight: var(--f-w-semi, 500); }
.lp-feedback {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-width: 320px;
    font-size: 12px;
    line-height: 1.45;
    color: var(--lp-muted);
}
.lp-muted-text { color: var(--lp-subtle); font-weight: 400; }
.lp-row-action { text-align: right; white-space: nowrap; }

.lp-view-btn {
    padding: 7px 15px;
    border-radius: 8px;
    border: 1px solid var(--lp-border);
    background: #fff;
    color: var(--lp-text);
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: var(--f-w-semi, 500);
    cursor: pointer;
    transition: all .15s;
}
.lp-view-btn:hover {
    border-color: var(--lp-primary);
    background: var(--lp-primary);
    color: #fff;
}

/* ── Quick-view popup ────────────────────────────────── */
.qv-backdrop {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(10,15,40,.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}
.qv-backdrop[hidden] { display: none; }
.qv-dialog {
    position: relative; /* anchors .qv-toast, which must outlive a body re-render */
    background: var(--lp-bg);
    border-radius: 14px;
    width: 100%;
    max-width: 780px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 24px 64px rgba(10,15,40,.35);
}
.qv-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 22px;
    background: linear-gradient(135deg, var(--lp-dark), var(--lp-dark2));
    color: #fff;
    flex-shrink: 0;
}
.qv-bar-title { margin: 0; font-size: 14px; font-weight: var(--f-w-bold, 600); letter-spacing: .02em; }
.qv-close {
    background: none; border: 0; color: rgba(255,255,255,.7);
    font-size: 26px; line-height: 1; cursor: pointer; padding: 0 4px;
}
.qv-close:hover { color: #fff; }

.qv-body { padding: 22px; overflow-y: auto; flex: 1 1 auto; }
.qv-loading, .qv-none {
    text-align: center;
    color: var(--lp-subtle);
    font-size: 13px;
    padding: 28px 0;
}
.qv-none i { margin-right: 6px; }

.qv-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 22px;
    background: #fff;
    border-top: 1px solid var(--lp-border);
    flex-shrink: 0;
}
.qv-foot .lp-btn { text-decoration: none; }

/* Close on the left, list navigation on the right. */
.qv-foot-nav {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}
.qv-foot-pos {
    font-size: 12px;
    font-weight: var(--f-w-semi, 500);
    color: var(--lp-subtle);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.qv-foot .lp-btn:disabled {
    opacity: .45;
    cursor: not-allowed;
}

@media (max-width: 560px) {
    .qv-foot { flex-wrap: wrap; }
    .qv-foot-nav { width: 100%; margin-left: 0; justify-content: space-between; }
}

/* popup content */
.qv-head {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #fff;
    border: 1px solid var(--lp-border);
    border-radius: var(--lp-radius);
    padding: 16px 18px;
    margin-bottom: 16px;
}
.qv-avatar {
    width: 46px; height: 46px;
    flex-shrink: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-d));
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; font-weight: var(--f-w-bold, 600);
}
.qv-head-main { flex: 1 1 auto; min-width: 0; }
.qv-name { margin: 0 0 5px; font-size: 16px; font-weight: var(--f-w-bold, 600); color: var(--lp-text); }
.qv-head-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.qv-phone {
    font-size: 12px;
    font-weight: var(--f-w-semi, 500);
    color: var(--lp-muted);
    font-variant-numeric: tabular-nums;
}
.qv-phone i { color: var(--lp-primary); font-size: 10px; margin-right: 3px; }
.qv-phone--alt i { color: var(--lp-subtle); }
.qv-status { flex-shrink: 0; }

.qv-quote {
    display: flex;
    gap: 10px;
    background: rgb(var(--accent-rgb) / .06);
    border-left: 3px solid var(--lp-primary);
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 16px;
}
.qv-quote i { color: var(--lp-primary); font-size: 11px; margin-top: 3px; }
.qv-quote p { margin: 0; font-size: 13px; line-height: 1.5; color: var(--lp-text); }

.qv-section {
    background: #fff;
    border: 1px solid var(--lp-border);
    border-radius: var(--lp-radius);
    padding: 15px 18px;
    margin-bottom: 14px;
}
.qv-section-title {
    display: flex; align-items: center; gap: 7px;
    margin: 0 0 12px;
    font-size: 11px;
    font-weight: var(--f-w-bold, 600);
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--lp-muted);
}
.qv-count {
    background: var(--lp-border);
    color: var(--lp-muted);
    border-radius: 100px;
    padding: 1px 7px;
    font-size: 10px;
}
.qv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px 18px;
    margin: 0;
}
.qv-cell dt {
    font-size: 10.5px;
    font-weight: var(--f-w-semi, 500);
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--lp-subtle);
    margin-bottom: 2px;
}
.qv-cell dd {
    margin: 0;
    font-size: 13px;
    font-weight: var(--f-w-semi, 500);
    color: var(--lp-text);
    word-break: break-word;
}

.qv-timeline { list-style: none; margin: 0; padding: 0; }
.qv-tl-item { display: flex; gap: 12px; padding-bottom: 16px; position: relative; }
.qv-tl-item:last-child { padding-bottom: 0; }
.qv-tl-item:not(:last-child)::before {
    content: '';
    position: absolute;
    left: 4px; top: 14px; bottom: 0;
    width: 1px;
    background: var(--lp-border);
}
.qv-tl-dot {
    width: 9px; height: 9px;
    flex-shrink: 0;
    border-radius: 50%;
    margin-top: 5px;
    background: currentColor;
}
.qv-tl-body { flex: 1 1 auto; min-width: 0; }
.qv-tl-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.qv-tl-when { font-size: 11px; color: var(--lp-subtle); font-variant-numeric: tabular-nums; white-space: nowrap; }
.qv-tl-note { margin: 6px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--lp-text); }
.qv-tl-foot { display: flex; gap: 14px; margin-top: 6px; }
.qv-tl-foot span { font-size: 11px; color: var(--lp-subtle); }
.qv-tl-foot i { margin-right: 4px; }

.qv-update-form { display: flex; flex-direction: column; gap: 12px; }
/* The fields live in a card like the Overview ones, so the card owns the
   stacking gap and the title loses its own bottom margin. */
.qv-update-form .qv-section--single { display: flex; flex-direction: column; gap: 13px; }
.qv-update-form .qv-section-title { margin-bottom: 0; }
.qv-field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: var(--f-w-semi, 500); color: var(--lp-muted); }
.qv-select, .qv-textarea {
    font-family: inherit;
    font-size: 13px;
    font-weight: 400;
    color: var(--lp-text);
    background: var(--lp-card);
    border: 1px solid var(--lp-border);
    border-radius: 8px;
    padding: 8px 10px;
}
.qv-select:focus, .qv-textarea:focus { outline: none; border-color: var(--lp-primary); }
.qv-textarea { resize: vertical; min-height: 60px; }
.qv-update-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.qv-update-msg { font-size: 12px; color: var(--lp-subtle); }
.qv-update-msg.is-error { color: var(--lp-red); }
.qv-update-msg.is-ok { color: var(--lp-green); }
.qv-update-submit[disabled] { opacity: .6; cursor: default; transform: none !important; }

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 768px) {
    .lp-header { padding: 22px 16px 22px; }
    .lp-header-inner { flex-direction: column; align-items: flex-start; }
    .lp-kpi-row { padding: 0 12px; margin-top: -14px; }
    .lp-toolbar { padding: 0 12px; }
    .lp-content { padding: 0 12px; }
    .lp-table thead th, .lp-table tbody td { padding: 10px 12px; }
    .qv-backdrop { padding: 0; }
    .qv-dialog { max-height: 100vh; border-radius: 0; }
}

/* ── Quick-view tabs + inline-edit overview ──────────────── */
.qv-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--lp-border);
    margin: -6px -6px 16px;
    padding: 0 6px;
}
.qv-tab {
    appearance: none;
    background: none;
    border: 0;
    cursor: pointer;
    padding: 10px 14px;
    font-family: 'Inter', sans-serif;
    font-size: 12.5px;
    font-weight: var(--f-w-semi, 500);
    color: var(--lp-subtle);
    border-bottom: 2px solid transparent;
    transition: color .15s, border-color .15s;
    white-space: nowrap;
}
.qv-tab:hover { color: var(--lp-text); }
.qv-tab.is-active { color: var(--lp-primary); border-bottom-color: var(--lp-primary); }
.qv-tab .qv-count { margin-left: 4px; }
.qv-tabpanel { display: none; }
.qv-tabpanel.is-active { display: block; }
.qv-grid--edit .qv-cell dd { font-weight: 400; }
.qv-input {
    width: 100%;
    font-family: inherit;
    font-size: 13px;
    font-weight: 400;
    color: var(--lp-text);
    background: var(--lp-card);
    border: 1px solid var(--lp-border);
    border-radius: 8px;
    padding: 7px 9px;
}
.qv-input:focus {
    outline: none;
    border-color: var(--lp-primary);
    box-shadow: 0 0 0 3px rgb(var(--accent-rgb) / .14);
}
.qv-input:hover:not(:focus) { border-color: #cbd5e1; }
.qv-input::placeholder { color: var(--lp-subtle); }

/* ── Header actions ──────────────────────────────────────── */
.qv-head-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 9px;
    flex-shrink: 0;
}
.qv-head-actions { display: flex; gap: 6px; }
.qv-act {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px; height: 30px;
    flex-shrink: 0;
    padding: 0;
    border: 1px solid var(--lp-border);
    border-radius: 9px;
    background: var(--lp-bg);
    color: var(--lp-muted);
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    text-decoration: none;
    transition: transform .15s, box-shadow .15s, background .15s, color .15s, border-color .15s;
}
.qv-act:hover {
    background: var(--lp-primary);
    border-color: var(--lp-primary);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgb(var(--accent-rgb) / .35);
}
/* Call and WhatsApp carry their own colour at rest, not only on hover — an
   agent picks the right one by colour before reading the glyph. Copy stays
   neutral so the two that place a call keep the eye. */
.qv-act--call {
    color: #6b35a8;
    border-color: rgba(37,99,235,.28);
    background: rgba(37,99,235,.07);
}
.qv-act--call:hover {
    background: #6b35a8;
    border-color: #6b35a8;
    color: #fff;
    box-shadow: 0 3px 10px rgba(37,99,235,.38);
}

.qv-act--wa {
    color: #128c3e;
    border-color: rgba(37,211,102,.35);
    background: rgba(37,211,102,.1);
}
.qv-act--wa:hover {
    background: #25d366;
    border-color: #25d366;
    color: #fff;
    box-shadow: 0 3px 10px rgba(37,211,102,.4);
}

.qv-wa-sheet {
    margin: 0 0 16px;
    padding: 14px 16px;
    border: 1px solid rgba(37,211,102,.35);
    border-radius: 12px;
    background: rgba(37,211,102,.06);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.qv-wa-sheet[hidden] { display: none; }
.qv-wa-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-weight: 700;
    font-size: 13px;
    color: #128c3e;
}
.qv-wa-close {
    border: 0;
    background: transparent;
    font-size: 20px;
    line-height: 1;
    color: #64748b;
    cursor: pointer;
}
.qv-wa-vars { display: flex; flex-direction: column; gap: 8px; }
.qv-wa-vars:empty { display: none; }
.qv-wa-preview {
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 13px;
    line-height: 1.5;
    color: #0f172a;
    background: #fff;
    border: 1px solid var(--lp-border, #e2e8f0);
    border-radius: 10px;
    padding: 10px 12px;
}
.qv-wa-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}
.qv-wa-chat { font-size: 12px; color: #128c3e; text-decoration: underline; }
.qv-wa-send[disabled] { opacity: .55; cursor: not-allowed; }

/* ── Overview: one card ──────────────────────────────────── */
.qv-section--single { padding: 16px 18px 14px; }
.qv-section-title i { color: var(--lp-primary); font-size: 12px; }
.qv-section-hint {
    margin-left: auto;
    font-size: 10.5px;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    color: var(--lp-subtle);
}
.qv-grid--edit { grid-template-columns: repeat(auto-fit, minmax(178px, 1fr)); gap: 13px 16px; }
.qv-req { color: var(--lp-red); margin-left: 2px; }

/* Read-only cells sit in the same grid as the inputs, so they need to read as
   "not editable" without looking broken next to a field. */
.qv-cell--ro dd .qv-static {
    display: block;
    padding: 7px 9px;
    border: 1px dashed var(--lp-border);
    border-radius: 8px;
    background: var(--lp-bg);
    font-size: 13px;
    font-weight: 500;
    color: var(--lp-muted);
    word-break: break-word;
}

/* System-set dates — same card, visually demoted below a rule. */
.qv-meta-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px dashed var(--lp-border);
}
.qv-meta { font-size: 11px; color: var(--lp-subtle); }
.qv-meta i { margin-right: 5px; font-size: 9.5px; }
.qv-meta b {
    font-weight: var(--f-w-semi, 500);
    color: var(--lp-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    font-size: 10px;
    margin-right: 3px;
}

/* ── Save bar ────────────────────────────────────────────── */
.qv-update-actions--sticky {
    position: sticky;
    bottom: -22px;
    margin: 0 -22px -22px;
    padding: 12px 22px;
    background: rgba(241,245,249,.94);
    backdrop-filter: blur(6px);
    border-top: 1px solid var(--lp-border);
    z-index: 2;
}
.qv-details-msg { font-size: 12px; color: var(--lp-subtle); }
.qv-details-msg.is-error { color: var(--lp-red); }
.qv-details-msg.is-ok { color: var(--lp-green); }
.qv-details-submit[disabled] { opacity: .6; cursor: default; transform: none !important; }

/* ── Save toast ──────────────────────────────────────────────
   Anchored to the dialog, not the body: the body is re-rendered on a
   successful save, which would destroy a message placed inside it. */
.qv-toast {
    position: absolute;
    left: 50%;
    top: 64px; /* clear of the title bar, clear of the sticky save bar */
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: calc(100% - 48px);
    padding: 10px 16px;
    border-radius: 100px;
    background: var(--lp-text);
    color: #fff;
    font-size: 12.5px;
    font-weight: var(--f-w-semi, 500);
    box-shadow: 0 8px 24px rgba(10,15,40,.28);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -12px);
    transition: opacity .2s ease, transform .2s ease;
}
.qv-toast.is-shown { opacity: 1; transform: translate(-50%, 0); }
.qv-toast.is-ok    { background: #047857; }
.qv-toast.is-error { background: #b91c1c; }
.qv-toast i { font-size: 13px; }

/* Row the agent just saved, so the change is traceable after the popup closes. */
.lp-table tbody tr.lp-row--updated {
    background: rgba(16,185,129,.07);
    box-shadow: inset 3px 0 0 var(--lp-green);
}

@media (max-width: 768px) {
    .qv-head { flex-wrap: wrap; }
    .qv-head-side { flex-direction: row; align-items: center; width: 100%; justify-content: space-between; }
    .qv-grid--edit { grid-template-columns: 1fr; }
}

/* ── Duplicate warning ───────────────────────────────────────
   Sits above the tabs so it is read before the agent starts working,
   not after they have already dialled. */
.qv-warn {
    display: flex;
    gap: 12px;
    margin: 0 0 4px;
    padding: 14px 16px;
    border: 1px solid #fcd9a4;
    border-left: 3px solid var(--lp-amber);
    border-radius: var(--lp-radius);
    background: #fffaf0;
}
.qv-warn-icon { color: var(--lp-amber); font-size: 15px; margin-top: 2px; }
.qv-warn-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.qv-warn-body > b    { font-size: 13.5px; color: #7c4a03; }
.qv-warn-body > span { font-size: 12.5px; color: #9a6210; }
.qv-warn-list {
    list-style: none;
    margin: 6px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.qv-warn-list li {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 12.5px;
}
.qv-warn-name { font-weight: var(--f-w-semi, 500); color: var(--lp-text); }
.qv-warn-meta { color: var(--lp-muted); font-size: 11.5px; }

/* ── Dictation ───────────────────────────────────────────────
   Speech recognition is Chrome/Edge only, so the whole row stays
   hidden until the script confirms support. */
.qv-dictate {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.qv-dictate[hidden] { display: none; }
.qv-mic {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 32px;
    padding: 0 12px;
    border: 1px solid var(--lp-border);
    border-radius: 100px;
    background: #fff;
    color: var(--lp-muted);
    font-size: 12px;
    font-weight: var(--f-w-semi, 500);
    font-family: inherit;
    cursor: pointer;
    transition: border-color .15s, color .15s, background .15s;
}
.qv-mic:hover { border-color: var(--lp-primary); color: var(--lp-primary); }
.qv-mic.is-live {
    border-color: var(--lp-red);
    background: #fef2f2;
    color: var(--lp-red);
}
.qv-mic.is-live i { animation: qv-pulse 1.2s ease-in-out infinite; }
@keyframes qv-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.qv-mic-lang {
    height: 32px;
    padding: 0 8px;
    border: 1px solid var(--lp-border);
    border-radius: 8px;
    background: #fff;
    font-family: inherit;
    font-size: 12px;
    color: var(--lp-muted);
    cursor: pointer;
}
.qv-mic:disabled, .qv-mic.is-off {
    opacity: .55;
    cursor: not-allowed;
    border-style: dashed;
}
.qv-mic:disabled:hover, .qv-mic.is-off:hover { border-color: var(--lp-border); color: var(--lp-muted); }
.qv-mic-hint { font-size: 11.5px; color: var(--lp-subtle); }
/* A hint that survives a stop — a blocked mic must keep saying so. */
.qv-mic-hint.is-sticky { color: var(--lp-red); font-weight: var(--f-w-semi, 500); }

/* Form-level error on the new lead dialog */
.qv-inline-error {
    margin: 0 0 14px;
    padding: 10px 14px;
    border: 1px solid #fecaca;
    border-left: 3px solid var(--lp-red);
    border-radius: 8px;
    background: #fef2f2;
    color: #991b1b;
    font-size: 13px;
    font-weight: 500;
}

/* ── Undo action inside the save toast ───────────────────────── */
.qv-toast-undo {
    margin-left: 4px;
    padding: 3px 10px;
    border: 1px solid rgba(255,255,255,.45);
    border-radius: 100px;
    background: transparent;
    color: #fff;
    font-family: inherit;
    font-size: 11.5px;
    font-weight: var(--f-w-bold, 600);
    cursor: pointer;
}
.qv-toast-undo:hover { background: rgba(255,255,255,.16); }
/* Clickable only while it is actually on screen. `has-action` alone left an
   invisible, full-width bar sitting inside the dialog after the toast faded,
   swallowing clicks meant for the form underneath it. */
.qv-toast.has-action.is-shown { pointer-events: auto; }

/* ── Unsaved-changes confirm ─────────────────────────────────
   A sheet inside the dialog rather than window.confirm(), so the agent
   can still see what they typed while deciding. */
.qv-confirm {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(10,15,40,.55);
    border-radius: inherit;
}
.qv-confirm-box {
    width: min(380px, 100%);
    background: #fff;
    border-radius: var(--lp-radius);
    padding: 22px 24px;
    box-shadow: 0 20px 50px -20px rgba(10,15,40,.7);
    text-align: left;
}
.qv-confirm-box h4 {
    margin: 0 0 6px;
    font-size: 15px;
    font-weight: var(--f-w-bold, 600);
    color: var(--lp-text);
}
.qv-confirm-box p {
    margin: 0 0 18px;
    font-size: 13px;
    color: var(--lp-muted);
    line-height: 1.55;
}
.qv-confirm-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* Save & next sits next to Save update, so the bar needs room on mobile. */
@media (max-width: 560px) {
    .qv-update-actions { flex-wrap: wrap; }
    .qv-update-actions .lp-btn { flex: 1 1 auto; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
    .qv-mic.is-live i { animation: none; }
}

/* ── Date range picker ───────────────────────────────────
   The CDN default renders ~669px wide with generous cells and its own
   blue/Arial styling. Tightened and repainted to match the panel. */
.daterangepicker {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 12px;
    border: 1px solid var(--lp-border);
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(10,15,40,.14);
    z-index: 2100;
}
.daterangepicker::before, .daterangepicker::after { display: none; }

/* Presets column: was ~140px of mostly whitespace. */
.daterangepicker .ranges { margin: 0; }
.daterangepicker .ranges ul { width: 116px; padding: 5px 0; }
.daterangepicker .ranges li {
    padding: 6px 11px;
    font-size: 12px;
    border-radius: 5px;
    margin: 0 5px;
}
.daterangepicker .ranges li.active { background: var(--lp-primary); }
.daterangepicker .ranges li:hover  { background: #f3edfa; }
.daterangepicker .ranges li.active:hover { background: var(--lp-primary); }

/* Two months, each narrower. */
.daterangepicker .drp-calendar { max-width: 196px; padding: 7px 9px; }
.daterangepicker .drp-calendar.left, .daterangepicker .drp-calendar.right { padding: 7px 9px; }
.daterangepicker .calendar-table { padding: 0; border: 0; }
.daterangepicker .calendar-table th,
.daterangepicker .calendar-table td {
    min-width: 24px;
    width: 24px;
    height: 23px;
    line-height: 23px;
    font-size: 11.5px;
    border-radius: 5px;
}
/* .month is a <th> too, so target only the weekday row here — otherwise
   the month heading greys out with it. */
.daterangepicker .calendar-table thead tr:last-child th { font-weight: var(--f-w-semi, 500); color: var(--lp-subtle); }
.daterangepicker th.month { font-size: 12.5px; font-weight: var(--f-w-bold, 600); color: var(--lp-text); }
.daterangepicker th.prev, .daterangepicker th.next { color: #475569; }

/* Repaint selection in the panel's indigo. */
.daterangepicker td.active, .daterangepicker td.active:hover { background: var(--lp-primary); }
.daterangepicker td.in-range { background: #f3edfa; color: var(--lp-text); }
.daterangepicker td.available:hover { background: var(--lp-border); }
.daterangepicker td.off, .daterangepicker td.off.in-range { color: #cbd5e1; background: transparent; }

/* Footer. */
.daterangepicker .drp-buttons { padding: 7px 10px; }
.daterangepicker .drp-selected { font-size: 11.5px; color: var(--lp-muted); }
.daterangepicker .drp-buttons .btn {
    padding: 4px 13px;
    font-size: 12px;
    font-weight: var(--f-w-semi, 500);
    border-radius: 6px;
}
.daterangepicker .drp-buttons .btn.btn-primary { background: var(--lp-primary); border-color: var(--lp-primary); color: #fff; }
.daterangepicker .drp-buttons .btn.btn-default { background: #fff; border-color: var(--lp-border); color: #475569; }

@media (max-width: 767px) {
    /* One month at a time; two never fit on a phone. */
    .daterangepicker .drp-calendar.right { display: none; }
    .daterangepicker .ranges ul { width: 100%; }
}

.qv-hint { font-size: 11.5px; font-weight: 400; color: var(--lp-subtle); }

/* ── Lead activity trail ─────────────────────────────────── */
.qv-note-in { width: 100%; }
.qv-note-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 9px; }
.qv-note-msg { font-size: 12px; color: var(--lp-subtle); }
.qv-note-msg.is-error { color: var(--lp-red); }
.qv-note-submit[disabled] { opacity: .6; cursor: default; }

.qv-act-wrap { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--lp-border); }
.qv-act-list { list-style: none; margin: 0; padding: 0; }
.qv-act-row { display: flex; gap: 11px; padding-bottom: 15px; position: relative; }
.qv-act-row:last-child { padding-bottom: 0; }
/* Connecting rail, so the entries read as one thread rather than loose rows. */
.qv-act-row:not(:last-child)::before {
    content: '';
    position: absolute;
    left: 13px; top: 30px; bottom: 0;
    width: 1px; background: var(--lp-border);
}
.qv-act-dot {
    width: 27px; height: 27px; flex-shrink: 0;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 10.5px; z-index: 1;
}
.qv-act-body { flex: 1 1 auto; min-width: 0; }
.qv-act-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.qv-act-kind { font-size: 11px; font-weight: var(--f-w-bold, 600); text-transform: uppercase; letter-spacing: .04em; }
.qv-act-when { font-size: 11px; color: var(--lp-subtle); white-space: nowrap; }
.qv-act-msg { margin: 3px 0 0; font-size: 12.5px; line-height: 1.55; color: var(--lp-text); word-break: break-word; }
.qv-act-who { font-size: 11px; color: var(--lp-subtle); }

/* ════════════════════════════════════════════════════════════
   COMPACT LIST LAYOUT
   ════════════════════════════════════════════════════════════

   This used to be a viewport-tall shell: .lp-wrapper--grid was a flex column
   of exactly 100vh with overflow:hidden, so the document could not scroll and
   .lp-table-wrap was the only scrollport on the page. That is what kept the
   table header pinned — and what put a second scrollbar inside the card, so
   reaching row 40 meant finding the inner scroller rather than just scrolling.

   The shell is an ordinary block again. The page scrolls, the header scrolls
   away with it, and the rows arrive a page at a time from the paginator
   instead of in one long scrolling column.

   What is kept is everything below: the density rules that stop the header,
   KPI row and filter card eating 500px before the first row. Those were worth
   having on their own, independently of who was doing the scrolling.
   ════════════════════════════════════════════════════════════ */

.lp-wrapper--grid {
    display: block;
}

/* .lp-content carries `margin: 0 auto`; keeping the full-width box means
   max-width still caps it and margin:auto still centres it. */
.lp-wrapper--grid > * { width: 100%; }
.lp-wrapper--grid > .lp-content:has(.lp-table-wrap),
.lp-wrapper--grid > .lp-table-block {
    padding-bottom: 16px;
}

/* ── Reclaimed space above the table ─────────────────────── */

/* Header: 132px -> ~84px. Same information, less air. */
.lp-wrapper--grid .lp-header      { padding: 14px 32px 13px; }
.lp-wrapper--grid .lp-title       { font-size: 19px; margin-bottom: 2px; }
.lp-wrapper--grid .lp-subtitle    { font-size: 12px; }
.lp-wrapper--grid .lp-breadcrumb  { margin-bottom: 6px; font-size: 11px; }

/* KPIs: 78px -> ~50px, and they scroll sideways instead of wrapping onto a
   second row on a narrow window. */
.lp-wrapper--grid .lp-kpi-row {
    margin-top: -10px;
}
/* One row that scrolls sideways, never several stacked rows.
   .lp-kpi-track is normally an auto-fill grid, so eight KPIs wrapped onto
   three lines — 293px of the screen gone before the table even started. */
.lp-wrapper--grid .lp-kpi-track {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    padding-bottom: 4px;
}
.lp-wrapper--grid .lp-kpi {
    flex: 0 0 auto;
    min-width: 148px;
    padding: 8px 14px;
}
.lp-wrapper--grid .lp-kpi:hover { transform: none; }   /* no lift inside a scroller */
.lp-wrapper--grid .lp-kpi-value { font-size: 17px; line-height: 1.2; }
.lp-wrapper--grid .lp-kpi-label { font-size: 10px; letter-spacing: .04em; }
.lp-wrapper--grid .lp-kpi-icon  { width: 30px; height: 30px; font-size: 13px; }

@media (max-width: 767px) {
    .lp-wrapper--grid .lp-header { padding: 12px 16px 11px; }
    .lp-wrapper--grid .lp-title  { font-size: 17px; }
}

/* ── Filter popup ────────────────────────────────────────────
   The filter card used to sit open above the table. On the user list it was
   420px tall — the table below it collapsed to 63px. It opens in a dialog
   now, so the rows get that space back and the filters are one click away.
   ──────────────────────────────────────────────────────────── */
.lp-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 13px;
    border: 1px solid var(--lp-border);
    border-radius: 8px;
    background: #fff;
    color: var(--lp-text, #1f2937);
    font-size: 12.5px;
    font-weight: var(--f-w-semi, 500);
    cursor: pointer;
}
.lp-filter-btn:hover { background: #f8fafc; }
.lp-filter-btn i     { color: var(--lp-primary); }
.lp-filter-btn .lp-filter-btn-count {
    background: var(--lp-primary);
    color: #fff;
    border-radius: 999px;
    padding: 1px 7px;
    font-size: 11px;
}

.lp-fmodal {
    position: fixed;
    inset: 0;
    z-index: 1600;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 16px;
    overflow-y: auto;
    background: rgba(15,23,42,.5);
}
.lp-fmodal[hidden] { display: none; }
.lp-fmodal-dialog {
    background: #fff;
    border-radius: 14px;
    width: 100%;
    max-width: 900px;
    box-shadow: 0 24px 60px rgba(15,23,42,.28);
    overflow: hidden;
}
.lp-fmodal-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--lp-border);
    background: #f8fafc;
}
.lp-fmodal-title {
    margin: 0;
    font-size: 15px;
    font-weight: var(--f-w-bold, 600);
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 8px;
}
.lp-fmodal-title i { color: var(--lp-primary); }
.lp-fmodal-x {
    border: 0;
    background: none;
    font-size: 22px;
    line-height: 1;
    color: #64748b;
    cursor: pointer;
    padding: 0 4px;
}
.lp-fmodal-x:hover { color: #0f172a; }
.lp-fmodal-body { padding: 16px 18px 20px; }
/* Inside the dialog the card is the dialog — drop its own frame. */
.lp-fmodal-body .lp-filter-card {
    border: 0;
    box-shadow: none;
    padding: 0;
    margin: 0;
    background: none;
}
.lp-fmodal-body .lp-filter-head { display: none; }


/* ── Denser lead rows ────────────────────────────────────────
   Only 7 leads fitted on screen: a 34px avatar plus two stacked lines plus
   12px padding made every row ~60px. Trimming the padding, the avatar and the
   line spacing gets a row to ~40px, so the same table area shows 11-12 leads
   without dropping any information from the row.
   ──────────────────────────────────────────────────────────── */
.lp-wrapper--grid .lp-table--leads tbody td   { padding: 3px 14px; }
.lp-wrapper--grid .lp-table--leads thead th   { padding: 6px 14px; }
.lp-wrapper--grid .lp-lead-cell               { gap: 8px; }
.lp-wrapper--grid .lp-avatar                  { width: 24px; height: 24px; font-size: 10.5px; }
.lp-wrapper--grid .lp-lead-text               { gap: 0; }
.lp-wrapper--grid .lp-lead-text .lp-name      { font-size: 12.5px; line-height: 1.25; }
.lp-wrapper--grid .lp-lead-text .lp-mobile    { font-size: 11px;   line-height: 1.25; }
/* Status pill and the row button were sized for the taller row. */
.lp-wrapper--grid .lp-table--leads .lp-status { padding: 2px 8px; font-size: 10.5px; }
.lp-wrapper--grid .lp-table--leads .lp-row-btn,
.lp-wrapper--grid .lp-table--leads .lp-btn--sm { padding: 4px 10px; font-size: 11.5px; }

/* The pagination bar and the card's own padding were the last of the wasted
   height below the rows. */
.lp-wrapper--grid .lp-pagination                        { padding: 7px 16px; }
.lp-wrapper--grid .lp-pagination .page-item .page-link  { padding: 3px 9px; font-size: 12px; }
.lp-wrapper--grid > .lp-content:has(.lp-table-wrap)     { padding-bottom: 8px; }

/* The chips row ("SHOWING …") and the toolbar sat on separate lines with
   their own margins; tighten both so the rows start higher. */
.lp-wrapper--grid .lp-chips   { padding: 4px 0; }
.lp-wrapper--grid .lp-toolbar { padding: 2px 0; margin: 0; }

/* Last of the vertical slack above the rows: the "SHOWING" chips row and the
   "Lead Records" title each carried their own margin on top of their padding,
   and .lp-card had a rounded-corner gap under the last row. */
.lp-wrapper--grid .lp-chips             { padding: 2px 0; margin: 0; }
/*
 | Trim the vertical spacing only.
 |
 | `padding: 6px 0` also wiped the 24px horizontal padding, and `margin: 0`
 | wiped the `max-width + auto` centring — so the "Lead Records" title slid out
 | past the card's left edge instead of lining up with it.
 */
.lp-wrapper--grid .lp-toolbar {
    margin: 0 auto;
    padding: 6px 24px 5px;
    min-height: 0;
}
.lp-wrapper--grid .lp-toolbar-title     { font-size: 13.5px; margin: 0; }
.lp-wrapper--grid > .lp-content:has(.lp-table-wrap) { padding-bottom: 4px; }
.lp-wrapper--grid .lp-card              { margin: 0; }
/* Rows should fill the box: no half-row of dead space at the bottom. */
.lp-wrapper--grid .lp-table--leads tbody tr:last-child td { border-bottom: 0; }

/* ── Column widths on the leads table ────────────────────────
   The identity cell was taking ~400px for a name and a number, which pushed
   Status to the middle of the screen and stranded the row button on the far
   right with a gap in between. Sizing the narrow columns lets the identity
   cell keep only what it needs and closes the dead space.
   ──────────────────────────────────────────────────────────── */
/*
 | Fix the narrow columns in px and leave the identity column alone, so it
 | absorbs whatever is left.
 |
 | Sizing 2/3/4 as percentages did not work: they summed to 74%, and the
 | unconstrained checkbox column happily took the other 25% — a 167px gap
 | before the first name. Only one column may be left to flex.
 */
.lp-wrapper--grid .lp-table--leads                       { table-layout: fixed; width: 100%; }
.lp-wrapper--grid .lp-table--leads .lp-td-check,
.lp-wrapper--grid .lp-table--leads thead th:first-child  { width: 40px; padding-right: 0; }
/*
 | Name and status sit together on the left, where they get read as a pair.
 | The slack goes to Last Called — the least important column — instead of
 | stretching the identity cell to 700px and pushing Status to mid-screen.
 */
.lp-wrapper--grid .lp-table--leads td:nth-child(2),
.lp-wrapper--grid .lp-table--leads th:nth-child(2)       { width: 320px; }
.lp-wrapper--grid .lp-table--leads td:nth-child(3),
.lp-wrapper--grid .lp-table--leads th:nth-child(3)       { width: 160px; }
/* no width here on purpose — this is the column that stretches */
.lp-wrapper--grid .lp-table--leads td:nth-child(4),
.lp-wrapper--grid .lp-table--leads th:nth-child(4)       { width: auto; }
.lp-wrapper--grid .lp-table--leads .lp-th-action         { width: 120px; white-space: nowrap; }
/* fixed layout clips instead of wrapping, so long names need an ellipsis */
.lp-wrapper--grid .lp-lead-text .lp-name,
.lp-wrapper--grid .lp-lead-text .lp-mobile { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* "Never called" repeated down the column is noise; let the real dates lead. */
.lp-wrapper--grid .lp-table--leads .lp-muted-text        { opacity: .65; }

/* A quiet zebra makes a dense table easier to track across. */
.lp-wrapper--grid .lp-table--leads tbody tr:nth-child(even) td { background: #fcfcfe; }
.lp-wrapper--grid .lp-table--leads tbody tr:hover td           { background: #f5f6ff; }

/* Any other table inside the grid layout gets the same denser rows the leads
   table has. On My Tasks the "Recently completed" list was using taller rows
   than the open tasks above it, so finished work dominated the screen. */
.lp-wrapper--grid .lp-table tbody td { padding: 6px 14px; }
.lp-wrapper--grid .lp-table thead th { padding: 7px 14px; }

/* Chips row lines up with the card too. */
.lp-wrapper--grid .lp-chips-row,
.lp-wrapper--grid > .lp-content { margin-left: auto; margin-right: auto; }

/* ═══════════════════════════════════════════════════════════════════════════
   Billing module additions — customers, sales invoices, inventory
   ═══════════════════════════════════════════════════════════════════════════
   These pages needed a search box in the toolbar, a flash message, status
   tags that carry meaning rather than one flat indigo, and a real row-action
   button. Adding them here rather than per page keeps the four screens in the
   module looking like one thing.

   .lp-row-btn in particular had no base rule at all — only a size override
   scoped to .lp-table--leads — so on every page outside the leads table it
   rendered as a default browser button with a black square border. */

.lp-row-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid var(--lp-border);
    border-radius: 8px;
    background: var(--lp-card);
    color: var(--lp-muted);
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    transition: color .12s, border-color .12s, background .12s;
}
.lp-row-btn + .lp-row-btn,
.lp-row-btn + .lp-inline-form { margin-left: 6px; }
.lp-row-btn:hover {
    color: var(--lp-primary);
    border-color: var(--lp-primary);
    background: rgb(var(--accent-rgb) / .06);
}
.lp-row-btn:focus-visible {
    outline: 2px solid var(--lp-primary);
    outline-offset: 1px;
}
.lp-row-btn--danger:hover {
    color: var(--lp-red);
    border-color: var(--lp-red);
    background: rgba(239,68,68,.06);
}

/* Keeps a POST-only action (delete needs a form for its CSRF token) sitting on
   the row instead of dropping onto its own line. */
.lp-inline-form {
    display: inline-block;
    margin: 0;
    vertical-align: middle;
}

/* Semantic variants of the tag. The base .lp-source-tag stays indigo and keeps
   meaning "a count / a label"; these two mean money owed in either direction,
   so they read at a glance without the reader parsing the words. */
.lp-source-tag--ok {
    background: rgba(16,185,129,.1);
    color: var(--lp-green);
}
.lp-source-tag--warn {
    background: rgba(245,158,11,.12);
    color: #b45309;
}
.lp-source-tag--muted {
    background: rgba(100,116,139,.1);
    color: var(--lp-muted);
}

/* Toolbar search. The magnifier sits inside the field rather than in a button
   group, so the toolbar stays one row on a narrow screen. */
.lp-search-form {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    flex-wrap: wrap;
}
.lp-search {
    position: relative;
    display: inline-flex;
    align-items: center;
}
.lp-search > i {
    position: absolute;
    left: 11px;
    font-size: 11.5px;
    color: var(--lp-subtle);
    pointer-events: none;
}
.lp-search > input {
    width: 240px;
    max-width: 100%;
    height: 34px;
    padding: 0 12px 0 30px;
    border: 1px solid var(--lp-border);
    border-radius: 8px;
    background: var(--lp-card);
    color: var(--lp-text);
    font-size: 12.5px;
    font-family: inherit;
}
.lp-search > input::placeholder { color: var(--lp-subtle); }
.lp-search > input:focus {
    outline: none;
    border-color: var(--lp-primary);
    box-shadow: 0 0 0 3px rgb(var(--accent-rgb) / .12);
}

/* A select that has to sit next to the search box and match its height. */
.lp-filter-select {
    height: 34px;
    padding: 0 30px 0 11px;
    border: 1px solid var(--lp-border);
    border-radius: 8px;
    background: var(--lp-card);
    color: var(--lp-text);
    font-size: 12.5px;
    font-family: inherit;
    cursor: pointer;
}
.lp-filter-select:focus {
    outline: none;
    border-color: var(--lp-primary);
    box-shadow: 0 0 0 3px rgb(var(--accent-rgb) / .12);
}

/* Flash message. Sits between the KPI row and the toolbar, full card width. */
.lp-flash {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0 auto 4px;
    padding: 10px 16px;
    border: 1px solid var(--lp-border);
    border-left: 3px solid var(--lp-muted);
    border-radius: 0 8px 8px 0;
    background: var(--lp-card);
    color: var(--lp-text);
    font-size: 13px;
}
.lp-flash--ok   { border-left-color: var(--lp-green); }
.lp-flash--ok   > i { color: var(--lp-green); }
.lp-flash--err  { border-left-color: var(--lp-red); }
.lp-flash--err  > i { color: var(--lp-red); }

/* Right-aligned numeric column: digits line up so a column of money can be
   compared down the page instead of read one row at a time. */
.lp-table .lp-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* ── Lead star rating (5 = high, 3 = medium, 1 = low) ── */
.lp-stars { display: inline-flex; gap: 4px; align-items: center; }
.lp-star {
    display: inline-flex; align-items: center; gap: 3px; padding: 3px 8px;
    border: 1px solid #e2e8f0; border-radius: 14px; background: #fff;
    color: #94a3b8; font-size: 11.5px; font-weight: 600; cursor: pointer; line-height: 1.3;
}
.lp-star i { font-size: 10px; }
.lp-star:hover { border-color: #f59e0b; color: #f59e0b; }
.lp-star.is-on { background: #fef3c7; border-color: #f59e0b; color: #b45309; }
.lp-stars--static { color: #f59e0b; letter-spacing: 1px; font-size: 12px; cursor: default; }

/* Rating box with a comment */
.lp-stars.has-note::after { content: '\f075'; font-family: 'Font Awesome 5 Free'; font-weight: 400; font-size: 11px; color: #94a3b8; margin-left: 4px; }
.lp-rate-pop { position: fixed; inset: 0; z-index: 2200; background: rgba(15,23,42,.45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.lp-rate-pop-card { width: 360px; max-width: 100%; background: #fff; border-radius: 14px; padding: 18px; box-shadow: 0 20px 50px rgba(15,23,42,.3); }
.lp-rate-pop-title { font-weight: 700; color: #1e293b; margin-bottom: 10px; }
.lp-rate-pop-stars { display: flex; gap: 6px; margin-bottom: 10px; }
.lp-rate-pop textarea { width: 100%; border: 1px solid #e2e8f0; border-radius: 8px; padding: 8px 10px; font: inherit; font-size: 13px; resize: vertical; }
.lp-rate-pop-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
.lp-rate-pop-actions button { border: 0; border-radius: 8px; padding: 7px 14px; font-size: 13px; cursor: pointer; background: #f1f5f9; color: #475569; margin-left: 6px; }
.lp-rate-pop-actions .lp-rate-save { background: #4f46e5; color: #fff; }
.lp-rate-pop-actions .lp-rate-remove { background: none; color: #dc2626; margin-left: 0; padding-left: 0; }
