/* Prospect Matching & Opportunities Styles */

/* ── Fullscreen Mode ──────────────────────────────────────────────────────── */
.app-shell.buyer-fullscreen .sidebar {
    display: none;
}

.app-shell.buyer-fullscreen #buyer-discovery-view {
    width: 100%;
}

#buyer-fullscreen-exit {
    display: none;
}

.app-shell.buyer-fullscreen #buyer-fullscreen-exit {
    display: flex;
}

.app-shell.buyer-fullscreen #buyer-fullscreen-enter {
    display: none;
}

/* ── Scrollbars ───────────────────────────────────────────────────────────── */
#buyer-discovery-tree::-webkit-scrollbar,
#buyer-discovery-detail-content::-webkit-scrollbar {
    width: 4px;
}

#buyer-discovery-tree::-webkit-scrollbar-track,
#buyer-discovery-detail-content::-webkit-scrollbar-track {
    background: transparent;
}

#buyer-discovery-tree::-webkit-scrollbar-thumb,
#buyer-discovery-detail-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

#buyer-discovery-tree::-webkit-scrollbar-thumb:hover,
#buyer-discovery-detail-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ── View Header ─────────────────────────────────────────────────────────── */
/* SCCB-PDE-BUYERDISCOVERY-UI-CORRECTION-V2-0905 */
#buyer-discovery-view .view-header {
    padding: 12px 20px 10px;
    flex-shrink: 0;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: space-between;
    border-bottom: 1px solid var(--ol-border);
    background: var(--ol-surface);
}

#buyer-discovery-view .view-header h1 {
    font-size: clamp(18px, 2vw, 24px);
    font-family: 'Cormorant Garamond', serif;
    font-weight: 400;
    letter-spacing: -0.02em;
    color: var(--ol-text-strong);
}

.buyer-discovery-title-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.buyer-discovery-subtitle {
    font-size: 12px;
    color: var(--ol-muted);
}

.buyer-lead-filter {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.buyer-discovery-manual-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--ol-muted);
}

/* ── Context Pill ─────────────────────────────────────────────────────────── */
#buyer-discovery-subtitle-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 6px 20px;
    border-bottom: 1px solid var(--ol-border);
    background: var(--ol-surface);
    flex-shrink: 0;
}

#buyer-lead-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px 4px 8px;
    border-radius: 999px;
    background: rgba(200, 169, 91, 0.1);
    border: 1px solid rgba(200, 169, 91, 0.24);
    cursor: pointer;
    transition: all 0.15s;
    max-width: 420px;
}

#buyer-lead-pill .material-symbols-outlined {
    font-size: 15px;
    color: var(--ol-gold);
    flex-shrink: 0;
}

.buyer-context-copy {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.buyer-context-kicker {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ol-gold);
}

#buyer-lead-pill-text {
    font-size: 11px;
    color: var(--ol-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#buyer-lead-pill-text .context-intent {
    font-weight: 700;
    color: var(--ol-gold);
}

#buyer-lead-pill-text .context-type,
#buyer-lead-pill-text .context-property,
#buyer-lead-pill-text .context-locality {
    color: var(--ol-muted-2);
}

#buyer-lead-pill-text .context-message {
    font-style: italic;
    color: var(--ol-muted);
}

/* ── Search Context Panel ─────────────────────────────────────────────────── */
#buyer-search-context-panel {
    flex-shrink: 0;
    padding: 10px 20px;
    border-bottom: 1px solid var(--ol-border);
    background: rgba(200, 169, 91, 0.04);
}

#buyer-search-context-panel .search-context-header {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ol-gold);
    margin-bottom: 8px;
}

#buyer-search-context-panel .search-context-flow {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

#buyer-search-context-panel .search-context-input,
#buyer-search-context-panel .search-context-output {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 6px 12px;
}

#buyer-search-context-panel .sc-label {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ol-muted);
}

#buyer-search-context-panel .sc-value {
    font-size: 12px;
    font-weight: 600;
    color: var(--ol-text-strong);
}

#buyer-search-context-panel .sc-value.flip-value {
    color: var(--ol-gold);
}

#buyer-search-context-panel .sc-arrow {
    font-size: 16px;
    color: var(--ol-muted);
}

#buyer-search-context-panel .search-context-detail {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

#buyer-search-context-panel .sc-row {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

#buyer-search-context-panel .sc-dl {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ol-muted);
}

#buyer-search-context-panel .sc-dd {
    font-size: 11px;
    color: var(--ol-text);
}

#buyer-search-context-panel .sc-intent {
    font-weight: 700;
    color: var(--ol-gold);
}

/* ── Source Filter Bar ────────────────────────────────────────────────────── */
#buyer-source-filter-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    border-bottom: 1px solid var(--ol-border);
    background: var(--ol-surface);
    flex-shrink: 0;
    flex-wrap: wrap;
}

#buyer-discovery-view .leads-top {
    padding: 10px 20px;
    flex-shrink: 0;
    border-bottom: 1px solid var(--ol-border);
    background: var(--ol-surface);
}

.buyer-filter-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.discovery-filter-group.buyer-filter-group-inline {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.discovery-filter-group.buyer-filter-group-inline .discovery-filter-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ol-muted);
    white-space: nowrap;
}

.buyer-filter-group .ol-select {
    padding: 4px 8px;
    font-size: 11px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--ol-text);
    cursor: pointer;
}

#buyer-source-filter-bar .discovery-inline-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    flex: 1;
}

#buyer-discovery-signal-rail[hidden] {
    display: none !important;
}

#buyer-discovery-signal-rail:not([hidden]) {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

#buyer-source-filter-bar .discovery-signal-pills {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

#buyer-discovery-signal-pills {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

#buyer-source-filter-bar .discovery-signal-chip {
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 500;
    font-family: 'Syne Mono', monospace;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: var(--ol-muted-2);
    transition: all 0.15s;
}

#buyer-source-filter-bar .discovery-signal-chip.active {
    background: rgba(200, 169, 91, 0.14);
    border-color: rgba(200, 169, 91, 0.32);
    color: var(--ol-gold);
}

.buyer-filter-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    margin-left: auto;
}

/* ── Saved Search Bar ─────────────────────────────────────────────────────── */
#buyer-saved-search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 20px;
    border-bottom: 1px solid var(--ol-border);
    background: rgba(200, 169, 91, 0.04);
    flex-shrink: 0;
}

#buyer-saved-search-bar .saved-search-cta {
    font-size: 11px;
    color: var(--ol-gold);
    cursor: pointer;
    text-decoration: underline;
    flex-shrink: 0;
}

#buyer-saved-search-bar .saved-search-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--ol-text-strong);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#buyer-saved-search-bar .saved-search-meta {
    font-size: 11px;
    color: var(--ol-muted);
    white-space: nowrap;
}

/* ── Results Shell ────────────────────────────────────────────────────────── */
#buyer-discovery-view .buyer-results-shell {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* ── Match Panel ──────────────────────────────────────────────────────────── */
.buyer-match-panel {
    display: flex;
    flex-direction: column;
    width: 340px;
    flex-shrink: 0;
    border-right: 1px solid var(--ol-border);
    background: var(--ol-surface);
    overflow: hidden;
}

body.light-theme .buyer-match-panel {
    background: #f8f9fa;
    border-right-color: #e9ecef;
}

.buyer-match-panel-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--ol-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.buyer-panel-heading {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.buyer-panel-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-family: 'Syne Mono', monospace;
    color: var(--ol-gold);
}

.buyer-panel-count {
    font-size: 22px;
    font-family: 'Cormorant Garamond', serif;
    font-weight: 400;
    color: var(--ol-text-strong);
    line-height: 1;
}

.buyer-panel-caption {
    font-size: 11px;
    color: var(--ol-muted);
}

.buyer-match-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

#buyer-discovery-detail-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* ── Buyer Cards ──────────────────────────────────────────────────────────── */
/* SCCB-DE-005: Buyer match cards */
.buyer-card {
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--ol-border);
    background: rgba(255, 255, 255, 0.02);
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.buyer-card:hover {
    background: rgba(200, 169, 91, 0.05);
    border-color: rgba(200, 169, 91, 0.2);
}

.buyer-card.selected {
    background: rgba(200, 169, 91, 0.1);
    border-color: rgba(200, 169, 91, 0.32);
    box-shadow: inset 3px 0 0 var(--ol-gold);
}

.buyer-card-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--ol-text-strong);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.buyer-card-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.buyer-card-context {
    font-size: 11px;
    color: var(--ol-muted);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}

/* ── Empty States ─────────────────────────────────────────────────────────── */
.buyer-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
    gap: 12px;
    flex: 1;
}

.buyer-detail-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 24px;
    text-align: center;
    gap: 12px;
    height: 100%;
}

.buyer-empty-card {
    padding: 24px;
    border-radius: 16px;
    border: 1px solid var(--ol-border);
    background: rgba(255, 255, 255, 0.02);
    max-width: 320px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.buyer-empty-kicker {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ol-gold);
}

.buyer-empty-title {
    font-size: 18px;
    font-family: 'Cormorant Garamond', serif;
    font-weight: 400;
    color: var(--ol-text-strong);
    line-height: 1.2;
}

.buyer-empty-body {
    font-size: 12px;
    color: var(--ol-muted);
    line-height: 1.5;
}

/* ── Pipeline View ────────────────────────────────────────────────────────── */
#buyer-pipeline-view .view-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--ol-border);
    background: var(--ol-surface);
}

#buyer-pipeline-view .view-header h1 {
    font-size: clamp(20px, 2vw, 28px);
    font-family: 'Cormorant Garamond', serif;
    font-weight: 400;
    letter-spacing: -0.02em;
    color: var(--ol-text-strong);
}

#buyer-pipeline-view .view-header p {
    font-size: 12px;
    color: var(--ol-muted);
    margin-top: 2px;
}

.pipeline-kicker {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ol-gold);
    margin-bottom: 4px;
}

#buyer-pipeline-view .leads-top {
    padding: 12px 20px;
    border-bottom: 1px solid var(--ol-border);
    background: var(--ol-surface);
    flex-shrink: 0;
}

#buyer-pipeline-view .leads-middle {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

#buyer-pipeline-view .leads-bottom {
    height: 360px;
    border-top: 1px solid var(--ol-border);
    display: grid;
    grid-template-columns: 1fr 1fr;
}

#buyer-pipeline-view .detail-panel {
    border-right: 1px solid var(--ol-border);
    overflow-y: auto;
    padding: 20px;
    background: var(--ol-surface);
}

body.light-theme #buyer-pipeline-view .detail-panel {
    background: #ffffff;
    border-right-color: #e9ecef;
}

/* ── Pipeline Filter & Table ──────────────────────────────────────────────── */
.pipeline-filter-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.pipeline-filter-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.pipeline-filter-group .input {
    padding: 6px 10px;
    font-size: 12px;
    border-radius: 8px;
}

.pipeline-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    flex-shrink: 0;
}

.pipeline-table-shell {
    background: var(--ol-surface);
    overflow: auto;
    height: 100%;
}

body.light-theme .pipeline-table-shell {
    background: #ffffff;
}

#buyer-pipeline-view .data-table th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--ol-surface);
}

/* ── Pipeline Rows ────────────────────────────────────────────────────────── */
.pipeline-row {
    cursor: pointer;
    transition: background 0.12s;
}

.pipeline-row:hover {
    background: rgba(200, 169, 91, 0.04);
}

.pipeline-row.selected {
    background: rgba(200, 169, 91, 0.08);
}

.pipeline-row.selected td {
    border-bottom-color: rgba(200, 169, 91, 0.16);
}

.pipeline-lead-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pipeline-lead-title,
.pipeline-buyer-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--ol-text-strong);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}

.pipeline-buyer-title {
    max-width: 180px;
}

.pipeline-subtext {
    font-size: 11px;
    color: var(--ol-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pipeline-token {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.06em;
    font-family: 'Syne Mono', monospace;
    white-space: nowrap;
}

/* Stage tokens */
.pipeline-stage-identified  { background: rgba(148, 163, 184, 0.12); border: 1px solid rgba(148, 163, 184, 0.24); color: #94a3b8; }
.pipeline-stage-contacted   { background: rgba(99, 102, 241, 0.12);  border: 1px solid rgba(99, 102, 241, 0.24);  color: #818cf8; }
.pipeline-stage-interested  { background: rgba(200, 169, 91, 0.12);  border: 1px solid rgba(200, 169, 91, 0.24);  color: var(--ol-gold); }
.pipeline-stage-negotiation { background: rgba(251, 146, 60, 0.12);  border: 1px solid rgba(251, 146, 60, 0.24);  color: #fb923c; }
.pipeline-stage-closed      { background: rgba(34, 197, 94, 0.12);   border: 1px solid rgba(34, 197, 94, 0.24);   color: #4ade80; }

/* Status tokens */
.pipeline-status-active  { background: rgba(34, 197, 94, 0.1);   border: 1px solid rgba(34, 197, 94, 0.22);   color: #4ade80; }
.pipeline-status-paused  { background: rgba(148, 163, 184, 0.1); border: 1px solid rgba(148, 163, 184, 0.22); color: #94a3b8; }
.pipeline-status-lost    { background: rgba(239, 68, 68, 0.1);   border: 1px solid rgba(239, 68, 68, 0.22);   color: #f87171; }
.pipeline-status-closed  { background: rgba(99, 102, 241, 0.1);  border: 1px solid rgba(99, 102, 241, 0.22);  color: #818cf8; }

.pipeline-stage-select {
    padding: 4px 8px;
    font-size: 11px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--ol-text);
    cursor: pointer;
}

body.light-theme .pipeline-stage-select {
    background: #ffffff;
    border-color: #dee2e6;
    color: #212529;
}

.pipeline-date {
    font-size: 12px;
    color: var(--ol-muted);
    white-space: nowrap;
}

/* ── Pipeline Detail ──────────────────────────────────────────────────────── */
.pipeline-detail-hero {
    padding: 0 0 16px;
    border-bottom: 1px solid var(--ol-border);
    margin-bottom: 16px;
}

.pipeline-detail-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.pipeline-detail-title {
    font-size: 18px;
    font-family: 'Cormorant Garamond', serif;
    font-weight: 500;
    color: var(--ol-text-strong);
    line-height: 1.2;
}

.pipeline-detail-subtitle {
    font-size: 12px;
    color: var(--ol-muted);
    margin-top: 2px;
}

.pipeline-detail-badges {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.pipeline-detail-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px 16px;
    margin-bottom: 16px;
}

.pipeline-meta-card {
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--ol-border);
}

body.light-theme .pipeline-meta-card {
    background: #f8f9fa;
    border-color: #e9ecef;
}

.pipeline-meta-label {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ol-muted);
    margin-bottom: 4px;
}

.pipeline-meta-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--ol-text-strong);
}

.pipeline-section {
    margin-bottom: 16px;
}

.pipeline-section-title {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ol-gold);
    margin-bottom: 8px;
    font-family: 'Syne Mono', monospace;
}

.pipeline-notes-box {
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--ol-border);
    background: rgba(255, 255, 255, 0.02);
    font-size: 12px;
    color: var(--ol-text);
    line-height: 1.5;
    min-height: 60px;
    resize: none;
    width: 100%;
    font-family: inherit;
}

.pipeline-action-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
    #buyer-discovery-view .buyer-results-shell {
        flex-direction: column;
    }

    .buyer-discovery-title-group {
        flex-direction: row;
        align-items: center;
        gap: 8px;
    }

    .buyer-lead-filter {
        flex-wrap: wrap;
    }

    #buyer-discovery-view .view-header {
        padding: 10px 14px;
    }

    #buyer-source-filter-bar {
        padding: 6px 14px;
    }

    .buyer-filter-actions {
        margin-left: 0;
    }

    #buyer-saved-search-bar {
        padding: 4px 14px;
        flex-wrap: wrap;
    }

    #buyer-lead-pill {
        max-width: 100%;
    }

    #buyer-discovery-view .buyer-results-shell {
        overflow-y: auto;
    }

    #buyer-lead-pill-text {
        font-size: 10px;
        max-width: 220px;
    }

    #buyer-pipeline-view .leads-bottom {
        height: 300px;
        grid-template-columns: 1fr;
    }

    .pipeline-detail-meta {
        grid-template-columns: 1fr 1fr;
    }
}