/* Styles loaded only by the lead management page. */
.crm-leads-heading,.crm-leads-footer{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap;margin:12px 0}
.crm-leads-heading h2{margin:0}.crm-leads-filters{display:flex;gap:10px;flex-wrap:wrap;margin:16px 0}.crm-leads-filters input,.crm-leads-filters select,.crm-leads-footer select{padding:8px 10px;border:1px solid var(--line,#dce3ed);border-radius:6px;background:var(--surface,#fff);color:inherit}
.crm-leads-filters input{min-width:220px}.crm-leads-summary{margin:12px 0;color:var(--muted,#64748b)}
.crm-leads-table{min-width:1560px}.crm-leads-table td{max-width:220px;white-space:pre-wrap;overflow-wrap:anywhere}.crm-leads-table th{white-space:nowrap}.crm-leads-table .lead-col-name{min-width:150px}.crm-leads-table .lead-col-contact{min-width:210px}.crm-leads-table .crm-lead-actions{min-width:270px}.crm-lead-actions .crm-button{margin:2px}
.crm-leads-workspace .crm-navigation [aria-current="page"]{background:#e8f0fe;color:#1d4ed8;border-color:#93b4ed}
.crm-lead-editor{padding:20px}.crm-lead-editor header{display:flex;justify-content:space-between;align-items:center}.crm-lead-editor .crm-form-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;margin:16px 0}.crm-lead-editor label{display:flex;flex-direction:column;gap:6px}.crm-lead-editor input,.crm-lead-editor select,.crm-lead-editor textarea{width:100%;padding:9px;border:1px solid #dce3ed;border-radius:6px;box-sizing:border-box}.crm-lead-extra{grid-column:1/-1}.crm-lead-details{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px}.crm-lead-details dt{color:#64748b}.crm-lead-details dd{margin:5px 0;white-space:pre-wrap;overflow-wrap:anywhere}.crm-lead-expanded pre{white-space:pre-wrap;overflow-wrap:anywhere}.crm-lead-followup{padding:12px 0;border-bottom:1px solid #dce3ed}.crm-lead-followup p{white-space:pre-wrap}.crm-lead-editor-row>td{padding:0}
@media(max-width:700px){.crm-lead-editor .crm-form-fields,.crm-lead-details{grid-template-columns:1fr}.crm-lead-editor{padding:12px}.crm-leads-filters input{min-width:0;width:100%}}
body[data-page="crmLeads"] #page-root{grid-template-columns:minmax(0,1fr)}
.crm-lead-view,.crm-leads-workspace{min-width:0;max-width:100%}
.crm-leads-table-wrap{max-height:65vh;position:relative}
.crm-leads-table{border-collapse:separate;border-spacing:0}
.crm-leads-table th{position:sticky;top:0;z-index:3}
.crm-leads-table th:last-child,.crm-leads-table .crm-lead-actions{position:sticky;right:0;background:#fff;min-width:240px;z-index:2;box-shadow:-3px 0 6px #183a5b08}
.crm-leads-table th:last-child{z-index:4;background:#f7f9fc}
.crm-leads-table .lead-col-name{position:sticky;left:0;z-index:2;background:#fff}
.crm-lead-editor-row .crm-lead-editor,.crm-lead-expanded>td>div{position:sticky;left:0;box-sizing:border-box;width:min(850px,calc(100vw - 340px))}
.sidebar-collapsed .crm-lead-editor-row .crm-lead-editor,.sidebar-collapsed .crm-lead-expanded>td>div{width:min(1100px,calc(100vw - 90px))}
@media(max-width:700px){.crm-leads-table .lead-col-name{position:static}.crm-leads-table .crm-lead-actions,.crm-leads-table th:last-child{min-width:140px}.crm-lead-editor-row .crm-lead-editor,.crm-lead-expanded>td>div{width:calc(100vw - 70px)}}

/* Match the existing customer workspace; never alter customer selectors. */
body[data-page="crmLeads"] .page-content{max-width:none;padding:0}
body[data-page="crmLeads"] #page-root{padding:8px 14px;gap:5px}
body[data-page="crmLeads"] .topbar{min-height:48px;height:48px;padding:5px 16px}
body[data-page="crmLeads"] .topbar-heading p,body[data-page="crmLeads"] .topbar-heading small{display:none}
body[data-page="crmLeads"] .topbar h1{font-size:17px}
.crm-leads-workspace{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:5px}
.crm-leads-workspace>.crm-leads-heading{grid-column:2;grid-row:1;margin:0;min-height:32px}
.crm-leads-heading>div:first-child{display:none}
.crm-leads-workspace>.crm-navigation{grid-column:1;grid-row:1;margin:0;padding:0;gap:4px;border:0;min-width:0;flex-wrap:wrap}
.crm-leads-workspace>.crm-leads-filters,.crm-leads-workspace>#crm-advanced-host,.crm-leads-workspace>.crm-filter-summary,.crm-leads-workspace>.crm-page-error,.crm-leads-workspace>.crm-leads-summary,.crm-leads-workspace>.crm-leads-table-wrap,.crm-leads-workspace>.crm-leads-footer{grid-column:1/-1}
.crm-leads-workspace>#crm-advanced-host:empty,.crm-leads-workspace>.crm-filter-summary:empty{display:none}
body[data-page="crmLeads"] .crm-button{padding:5px 8px;min-height:28px;font-size:12px}
.crm-leads-heading .crm-actions{gap:5px}
.crm-leads-filters{gap:6px;margin:4px 0}
.crm-leads-filters input,.crm-leads-filters select,.crm-leads-footer select{min-height:28px;height:28px;padding:4px 7px;font-size:12px}
.crm-leads-filters input{min-width:200px}
.crm-leads-summary{margin:0;padding:2px 0;font-size:12px}
.crm-leads-table-wrap{height:calc(100dvh - 245px);min-height:280px;max-height:none;scrollbar-gutter:stable;border-radius:6px}
.crm-leads-table{table-layout:fixed;width:1770px;min-width:100%;font-size:12px}
.crm-leads-table th{height:36px;box-sizing:border-box;padding:6px 8px;background:#f3f6fa;border-right:1px solid var(--line-soft)}
.crm-leads-table>tbody>tr[data-lead-row]>td{height:44px;box-sizing:border-box;padding:6px 8px;vertical-align:middle;border-right:1px solid var(--line-soft)}
.crm-leads-table th:nth-child(1){width:170px;left:0;z-index:5}
.crm-leads-table th:nth-child(2){width:170px}
.crm-leads-table th:nth-child(3){width:115px}
.crm-leads-table th:nth-child(4){width:220px}
.crm-leads-table th:nth-child(5){width:105px}
.crm-leads-table th:nth-child(6){width:110px}
.crm-leads-table th:nth-child(7){width:115px}
.crm-leads-table th:nth-child(8){width:150px}
.crm-leads-table th:nth-child(9){width:130px}
.crm-leads-table th:nth-child(10){width:170px}
.crm-leads-table th:last-child{width:265px;min-width:265px}
.crm-leads-table .crm-lead-actions{min-width:265px;white-space:nowrap}
.crm-lead-actions .crm-button{font-size:11px!important;padding:3px 5px!important;min-height:24px!important;margin:0 2px 0 0}
.crm-lead-cell-value{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;max-height:38px;overflow:hidden;white-space:pre-wrap;overflow-wrap:anywhere}
.crm-leads-footer{margin:0;padding-top:5px;justify-content:flex-end;font-size:12px;gap:8px}
.crm-leads-footer>span:first-child{margin-right:auto}
@media(max-width:1100px){.crm-leads-workspace{grid-template-columns:minmax(0,1fr)}.crm-leads-workspace>.crm-leads-heading{grid-column:1;grid-row:2;justify-content:flex-end}.crm-leads-workspace>.crm-navigation{grid-column:1;grid-row:1}}
@media(max-width:700px){body[data-page="crmLeads"] #page-root{padding:6px 10px}.crm-leads-table-wrap{height:55dvh}.crm-leads-table th:first-child{position:sticky;left:auto}.crm-leads-table th:last-child,.crm-leads-table .crm-lead-actions{position:static}.crm-leads-filters input{width:100%}}
/* Keep workspace navigation separate from list filters and avoid clipped row actions. */
.crm-leads-workspace>.crm-navigation[aria-label="线索视图"]{grid-column:1/-1;grid-row:1;margin-bottom:4px}
.crm-leads-workspace>.crm-navigation[aria-label="线索筛选视图"]{grid-column:1;grid-row:2}
.crm-leads-workspace>.crm-leads-heading{grid-row:2}
.crm-leads-table .crm-lead-actions{white-space:normal}
.crm-lead-actions .crm-button{display:inline-block;margin-bottom:3px}
.crm-leads-table-wrap{height:calc(100dvh - 285px)}
@media(max-width:1100px){.crm-leads-workspace>.crm-leads-heading{grid-row:3}.crm-leads-workspace>.crm-navigation[aria-label="线索筛选视图"]{grid-column:1/-1}}
@media(max-width:700px){.crm-leads-table-wrap{height:55dvh}}

.crm-leads-workspace>.crm-navigation[aria-label="线索视图"]{grid-column:1;grid-row:1;margin-bottom:0}.crm-leads-workspace>.crm-leads-heading{grid-row:1}.crm-leads-table-wrap{height:calc(100dvh - 245px)}
@media(max-width:1100px){.crm-leads-workspace>.crm-leads-heading{grid-row:2}.crm-leads-workspace>.crm-navigation[aria-label="线索视图"]{grid-column:1/-1}}
@media(max-width:700px){.crm-leads-table-wrap{height:55dvh}}
/* FastMoss's seven identity/contact columns, shared with the public lead list. */
.crm-leads-table{width:1740px}
.crm-leads-table th:nth-child(1){width:175px}
.crm-leads-table th:nth-child(2){width:175px}
.crm-leads-table th:nth-child(3){width:165px}
.crm-leads-table th:nth-child(4){width:100px}
.crm-leads-table th:nth-child(5){width:230px}
.crm-leads-table th:nth-child(6){width:220px}
.crm-leads-table th:nth-child(7){width:265px}
.crm-leads-table th:last-child{width:265px}
.crm-leads-table td[data-lead-field][tabindex]{cursor:text}
.crm-leads-table td[data-lead-field][tabindex]:hover{background:#f0f6ff}
.crm-leads-table td.crm-lead-cell-editing{padding:3px;overflow:visible;box-shadow:inset 0 0 0 2px #3b82f6;background:#fff;z-index:6}
.crm-lead-cell-editing input,.crm-lead-cell-editing textarea{width:100%;min-width:0;box-sizing:border-box;border:0;border-radius:0;padding:6px;background:#fff;font:inherit;resize:vertical;outline:none}
.crm-lead-cell-feedback{font-size:11px;white-space:normal;color:#b42318}.crm-lead-cell-feedback:empty{display:none}

.crm-flow-management summary{padding:12px 15px;color:#afbed0;font-size:12px;cursor:pointer}.crm-flow-management[open] summary{color:#fff}.crm-flow-management a{font-size:12px}
.crm-public-guidance{grid-row:1;grid-column:1;margin:0;align-self:center;color:#64748b;font-size:12px}
.crm-public-status{display:block;font-size:11px;color:#506680;margin-bottom:4px}
