/* A restrained, scannable CRM layer on top of the existing operations theme. */
.crm-layout-switch{display:flex;align-items:center;gap:4px;flex-wrap:nowrap}
.crm-lead-table .visually-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
.crm-layout-switch .btn{white-space:nowrap}
.crm-layout-switch .crm-layout-active{background:var(--ink,#18201b);border-color:var(--ink,#18201b);color:#fff}
.crm-workspace-layout{display:grid;grid-template-columns:minmax(0,1fr);min-width:0;align-items:start}
.crm-workspace-layout.crm-has-quick{grid-template-columns:minmax(0,1fr) minmax(316px,380px);gap:0;border:1px solid var(--border);border-radius:12px;overflow:hidden}
.crm-list-pane{min-width:0}
.crm-table-scroll{overflow-x:auto;overscroll-behavior-x:contain}
.crm-lead-table{width:100%;min-width:805px;border-collapse:separate;border-spacing:0;text-align:left;font-size:12px;color:var(--text2,var(--ink))}
.crm-lead-table th{position:sticky;top:0;z-index:1;padding:10px 12px;background:var(--surface-soft,#f6f7f5);color:var(--muted);font-size:11px;font-weight:650;letter-spacing:.01em;white-space:nowrap;border-bottom:1px solid var(--border)}
.crm-lead-table th:first-child{left:0;z-index:3;width:42px}
.crm-lead-table th:nth-child(2){left:42px;z-index:3}
.crm-lead-table td{padding:10px 12px;border-bottom:1px solid var(--line);vertical-align:middle;max-width:235px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;background:var(--surface)}
.crm-lead-table td:first-child{position:sticky;left:0;z-index:2;width:42px;min-width:42px;max-width:42px;padding-left:12px;padding-right:8px}
.crm-lead-table td:nth-child(2){position:sticky;left:42px;z-index:1;min-width:170px;max-width:235px}
.crm-check-cell input{width:15px;height:15px;accent-color:var(--ink,#18201b);cursor:pointer}
.crm-lead-table tbody tr{cursor:pointer}
.crm-lead-table tbody tr:hover td,.crm-lead-table tbody tr:focus-visible td,.crm-lead-table tbody tr.crm-row-active td{background:var(--surface-soft,#f6f7f5)}
.crm-lead-table tbody tr:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}
.crm-lead-table tbody tr.crm-row-unread td:nth-child(2){box-shadow:inset 3px 0 var(--accent)}
.crm-name-cell strong{display:block;overflow:hidden;text-overflow:ellipsis;color:var(--ink);font-size:13px;font-weight:650}
.crm-name-cell small{display:block;margin-top:4px;color:var(--muted);font-size:11px;overflow:hidden;text-overflow:ellipsis}
.crm-need-cell span{display:block;overflow:hidden;text-overflow:ellipsis}
.crm-stage{display:inline-block;padding:3px 7px;border-radius:5px;background:var(--surface-soft,#f3f3f0);color:var(--ink);font-size:11px}
.crm-stage-won{color:var(--green,#247d55);background:var(--green-soft,#eaf6ee)}
.crm-stage-lost{color:var(--muted)}
.crm-due{color:var(--red,#ac4234);font-weight:650}
.crm-row-action{text-align:right}
.crm-quick-panel{min-width:0;background:var(--surface);border-left:1px solid var(--border);max-height:min(80vh,900px);overflow-y:auto}
.crm-quick-head{position:sticky;top:0;z-index:2;display:flex;align-items:center;justify-content:space-between;padding:13px 18px;border-bottom:1px solid var(--line);background:var(--surface);font-size:12px;font-weight:650;color:var(--muted)}
.crm-quick-tabs{position:sticky;top:59px;z-index:2;display:flex;gap:20px;padding:0 18px;border-bottom:1px solid var(--line);background:var(--surface)}
.crm-quick-tabs button{padding:10px 0;border:0;border-bottom:2px solid transparent;background:transparent;color:var(--muted);font-size:12px;cursor:pointer}
.crm-quick-tabs button[aria-selected="true"]{border-bottom-color:var(--ink);color:var(--ink);font-weight:650}
.crm-quick-close{display:grid;place-items:center;width:32px;height:32px;border:1px solid var(--line);border-radius:7px;background:var(--surface);color:var(--muted);font-size:20px;cursor:pointer}
.crm-quick-close:hover{background:var(--surface-soft)}
.crm-quick-content{padding:18px}
.crm-quick-content h3{margin:0;color:var(--ink);font-size:19px;line-height:1.25;overflow-wrap:anywhere}
.crm-quick-subtitle{margin:6px 0 16px;color:var(--muted);font-size:12px}
.crm-quick-actions{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:10px}
.crm-quick-section{padding:16px 0;border-top:1px solid var(--line)}
.crm-quick-section h4{margin:0 0 10px;color:var(--ink);font-size:12px;letter-spacing:.01em}
.crm-quick-section p{margin:0;color:var(--text2,var(--ink));font-size:12px;line-height:1.55}
.crm-quick-section p strong{display:block;font-weight:650;color:var(--ink)}
.crm-quick-section p small{display:block;color:var(--muted);font-size:11px}
.crm-quick-message{white-space:pre-wrap;overflow-wrap:anywhere;max-height:220px;overflow-y:auto}
.crm-quick-muted{color:var(--muted)!important}
.crm-quick-error{color:var(--red,#ac4234)!important}
.crm-mail-unknown{padding:10px 12px;border:1px solid #b78436;border-radius:8px;background:#fff6e4;color:#6f4a19;font-size:12px;line-height:1.55}
.crm-mail-audit{margin-bottom:14px;border-left:3px solid #b78436}
.crm-mail-audit>strong{display:block;font-size:12px;color:var(--ink)}
.crm-mail-audit>p{margin:5px 0 10px;color:var(--muted);font-size:11px;line-height:1.5}
.crm-mail-audit-row{display:grid;gap:3px;padding:8px 0;border-top:1px solid var(--line);font-size:11px;color:var(--ink);overflow-wrap:anywhere}
.crm-mail-audit-row small{color:var(--muted)}
.crm-mail-reader h4 small{display:block;margin-top:4px;color:var(--muted);font-size:11px;font-weight:400}
.crm-mail-message-list{display:grid;gap:5px}
.crm-mail-message{display:grid;width:100%;gap:3px;padding:10px 11px;border:1px solid var(--line);border-radius:7px;background:var(--surface);color:var(--text2);text-align:left;cursor:pointer}
.crm-mail-message:hover,.crm-mail-message[aria-pressed="true"]{border-color:var(--ink);background:var(--surface-soft)}
.crm-mail-message strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:11px;color:var(--ink)}
.crm-mail-message small{color:var(--muted);font-size:10px}
.crm-mail-message>span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:11px;color:var(--muted)}
.crm-mail-more{margin-top:8px}
.crm-mail-full{margin-top:14px;padding-top:14px;border-top:1px solid var(--line)}
.crm-mail-full h5{margin:0;font-size:13px;color:var(--ink);overflow-wrap:anywhere}
.crm-mail-full p,.crm-mail-full small{display:block;margin:5px 0;color:var(--muted);font-size:11px;overflow-wrap:anywhere}
.crm-mail-full pre{margin:12px 0;padding:12px;border:1px solid var(--line);border-radius:7px;background:var(--surface-soft);color:var(--ink);font-family:inherit;font-size:12px;line-height:1.55;white-space:pre-wrap;overflow-wrap:anywhere}
.crm-mail-minimized{position:fixed;right:20px;bottom:20px;z-index:74;display:flex;gap:9px;align-items:center;max-width:min(360px,calc(100vw - 32px));padding:10px 13px;border:1px solid var(--line);border-radius:10px;background:var(--ink);box-shadow:0 8px 24px rgba(0,0,0,.16);color:#fff;font-size:12px;cursor:pointer}
.crm-mail-minimized span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;opacity:.72}
.crm-quick-activity{display:grid;grid-template-columns:1fr auto;gap:3px 8px;padding:8px 0!important;border-bottom:1px solid var(--line)}
.crm-quick-activity:last-child{border-bottom:0}
.crm-quick-activity>span:last-child{grid-column:1/-1;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;white-space:pre-wrap;overflow-wrap:anywhere;color:var(--muted)}
@media(max-width:1100px){.crm-workspace-layout.crm-has-quick{grid-template-columns:minmax(0,1fr)}.crm-quick-panel{position:fixed;inset:0 0 0 auto;z-index:75;width:min(420px,100vw);max-height:none;box-shadow:-12px 0 32px rgba(0,0,0,.14)}}
@media(max-width:600px){.crm-layout-switch{width:100%;justify-content:flex-end}.crm-lead-table{min-width:695px}.crm-quick-panel{width:100vw}.crm-quick-content{padding:16px}.crm-quick-head{padding:10px 16px}}
@media(prefers-reduced-motion:no-preference){.crm-quick-panel{animation:crm-panel-in .16s ease-out}@keyframes crm-panel-in{from{opacity:.75;transform:translateX(8px)}to{opacity:1;transform:translateX(0)}}}

/* R2 company read workspace: no global theme overrides or nested marketing cards. */
.crm-entity-page{flex:1;overflow-y:auto;padding:clamp(18px,2.5vw,34px);background:var(--surface-soft,#f6f6f3)}
.crm-entity-heading{display:flex;justify-content:space-between;align-items:end;gap:18px;margin:0 0 22px}
.crm-entity-eyebrow{font-size:11px;font-weight:700;letter-spacing:.08em;color:var(--muted)}
.crm-entity-heading h1{margin:5px 0;font-size:clamp(24px,2.4vw,32px);line-height:1.2;letter-spacing:-.03em;color:var(--ink)}
.crm-entity-heading p,.crm-entity-detail-head p{margin:0;color:var(--muted);font-size:12px;line-height:1.6}
.crm-entity-entry{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:11px 14px;margin-bottom:14px;border:1px solid var(--border);border-radius:10px;background:var(--surface);color:var(--muted);font-size:12px}
.crm-entity-entry-actions{display:flex;flex-wrap:wrap;gap:8px}
.crm-entity-page .btn{min-height:40px;white-space:nowrap}
.crm-entity-layout{display:grid;grid-template-columns:minmax(255px,330px) minmax(0,1fr);gap:16px;align-items:start;max-width:1500px}
.crm-entity-list,.crm-entity-detail{min-width:0;background:var(--surface);border:1px solid var(--border);border-radius:12px;overflow:hidden}
.crm-entity-list-head{padding:17px 17px 11px;display:flex;align-items:start;justify-content:space-between;gap:10px}
.crm-entity-list-head strong{display:block;color:var(--ink);font-size:15px}
.crm-entity-list-head small{display:block;color:var(--muted);font-size:11px;margin-top:3px}
.crm-entity-search{display:flex;gap:7px;padding:0 17px 13px;border-bottom:1px solid var(--line)}
.crm-entity-search .input{min-width:0;flex:1}
.crm-entity-items{max-height:min(68vh,800px);overflow:auto}
.crm-entity-item{display:grid;gap:4px;width:100%;min-height:58px;padding:14px 17px;border:0;border-bottom:1px solid var(--line);background:var(--surface);text-align:left;cursor:pointer;transition-property:background-color,box-shadow;transition-duration:150ms}
.crm-entity-item:focus-visible,.crm-entity-tabs button:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}
.crm-entity-item:hover,.crm-entity-item[aria-current="true"]{background:var(--surface-soft,#f6f6f3)}
.crm-entity-item[aria-current="true"]{box-shadow:inset 3px 0 var(--accent)}
.crm-entity-item strong{font-size:13px;color:var(--ink);overflow-wrap:anywhere}
.crm-entity-item span{font-size:11px;color:var(--muted);overflow-wrap:anywhere}
.crm-entity-pager{display:flex;justify-content:space-between;align-items:center;gap:8px;padding:12px 17px;color:var(--muted);font-size:11px}
.crm-entity-status,.crm-entity-error{margin:0;padding:28px 18px;color:var(--muted);font-size:12px;line-height:1.6}
.crm-entity-error{color:var(--red,#a33)}
.crm-entity-detail-head{padding:23px 26px 19px}
.crm-entity-detail-head h2{font-size:clamp(20px,2vw,27px);line-height:1.25;color:var(--ink);margin:7px 0;overflow-wrap:anywhere;text-wrap:balance}
.crm-entity-company-action{display:flex;gap:8px;flex-wrap:wrap;padding:0 26px 18px}
.crm-contact-editor{margin:0 26px 18px}
.crm-opportunity-editor{max-width:1500px;margin:0 0 16px}
.crm-opportunity-editor>.crm-entity-muted{margin:0;line-height:1.5}
.crm-opportunity-editor-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:13px}
.crm-opportunity-editor-grid label{display:grid;gap:6px;min-width:0;color:var(--ink);font-size:12px;font-weight:600}
.crm-opportunity-editor-grid .input{width:100%;min-width:0}
.crm-entity-summary{display:flex;gap:18px;flex-wrap:wrap;margin-top:15px;font-size:11px;color:var(--muted)}
.crm-entity-summary strong{color:var(--ink)}
.crm-entity-tabs{display:flex;gap:22px;padding:0 26px;border-top:1px solid var(--line);border-bottom:1px solid var(--line);overflow-x:auto}
.crm-entity-tabs button{white-space:nowrap;padding:11px 0;border:0;border-bottom:2px solid transparent;background:none;color:var(--muted);cursor:pointer;font-size:12px}
.crm-entity-tabs button[aria-selected="true"]{border-bottom-color:var(--accent);color:var(--ink);font-weight:700}
.crm-entity-content{padding:21px 26px 26px;min-height:175px}
.crm-entity-content h3{font-size:14px;color:var(--ink);margin:0 0 11px}
.crm-entity-content-grid{display:grid;grid-template-columns:minmax(0,1.5fr) minmax(180px,.8fr);gap:25px}
.crm-entity-project,.crm-entity-person,.crm-entity-event{padding:13px 0;border-top:1px solid var(--line)}
.crm-entity-project strong,.crm-entity-person strong,.crm-entity-event strong{display:block;color:var(--ink);font-size:12px;overflow-wrap:anywhere}
.crm-entity-project p,.crm-entity-event p{margin:5px 0;color:var(--muted);font-size:12px;line-height:1.55;white-space:pre-wrap;overflow-wrap:anywhere}
.crm-entity-project small,.crm-entity-person small,.crm-entity-event small{display:block;color:var(--muted);font-size:11px;overflow-wrap:anywhere}
.crm-entity-event>div{display:flex;justify-content:space-between;gap:10px}
.crm-entity-muted{color:var(--muted);font-size:12px}
.crm-opportunity-detail{display:grid;gap:18px}
.crm-opportunity-detail>.btn{justify-self:start}
.crm-opportunity-detail>.crm-entity-muted{margin:0;line-height:1.6;text-wrap:pretty}
.crm-opportunity-facts{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px}
.crm-opportunity-facts>div{min-width:0;padding:0 12px 0 0;border-right:1px solid var(--line)}
.crm-opportunity-facts>div:last-child{border-right:0}
.crm-opportunity-facts span,.crm-opportunity-facts strong{display:block;overflow-wrap:anywhere}
.crm-opportunity-facts span{color:var(--muted);font-size:11px}
.crm-opportunity-facts strong{margin-top:6px;color:var(--ink);font-size:14px;font-weight:650;font-variant-numeric:tabular-nums}
.crm-rfq-reader{border-top:1px solid var(--line);padding-top:18px;display:grid;gap:12px;min-width:0}
.crm-rfq-reader-head{display:flex;align-items:start;justify-content:space-between;gap:12px}
.crm-rfq-reader-head h3{margin:0 0 4px;font-size:16px;color:var(--ink)}
.crm-rfq-reader-head p{margin:0;color:var(--muted);font-size:12px;line-height:1.55}
.crm-rfq-head-actions{display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end}
.crm-rfq-reader-list{display:flex;flex-wrap:wrap;gap:8px}
.crm-rfq-reader-list .btn[aria-current="true"]{border-color:var(--accent);color:var(--accent)}
.crm-rfq-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1px;background:var(--line);border:1px solid var(--line);border-radius:8px;overflow:hidden}
.crm-rfq-fields>div{min-width:0;background:var(--surface);padding:12px 14px;display:grid;gap:5px;overflow-wrap:anywhere}
.crm-rfq-fields span,.crm-rfq-fields small{font-size:11px;color:var(--muted)}
.crm-rfq-fields strong{font-size:13px;font-weight:600;color:var(--ink);white-space:pre-wrap}
.crm-rfq-history{display:grid;gap:10px;padding:14px;border:1px solid var(--border);border-radius:9px;min-width:0}
.crm-rfq-history-controls{display:flex;align-items:center;gap:9px;flex-wrap:wrap}
.crm-rfq-history-controls label{font-size:12px;font-weight:600;color:var(--ink)}
.crm-rfq-history-controls .input{width:88px;min-width:0}
.crm-rfq-history .crm-entity-muted,.crm-rfq-history .crm-entity-error,.crm-rfq-history .crm-entity-status{margin:0;padding:0;line-height:1.5}
.crm-rfq-history-detail{display:grid;gap:9px}
.crm-rfq-history-detail>strong{font-size:12px;color:var(--ink)}
.crm-rfq-edit-button{justify-self:start}
.crm-rfq-editor{display:grid;gap:14px;padding:18px;border:1px solid var(--border);border-radius:10px;background:var(--surface-soft,#f6f6f3);min-width:0}
.crm-rfq-editor-head{display:flex;align-items:start;justify-content:space-between;gap:12px}
.crm-rfq-editor-head strong{display:block;font-size:14px;color:var(--ink)}
.crm-rfq-editor-head p,.crm-rfq-editor-footer span{margin:4px 0 0;color:var(--muted);font-size:11px;line-height:1.55}
.crm-rfq-title,.crm-rfq-editor-field label,.crm-rfq-add-field label{display:grid;gap:6px;color:var(--ink);font-size:12px;font-weight:600}
.crm-rfq-title .input{width:100%;min-width:0}
.crm-rfq-editor-fields{display:grid;gap:10px}
.crm-rfq-editor-field{display:grid;gap:6px;min-width:0}
.crm-rfq-editor-field label{display:flex;align-items:baseline;gap:9px;flex-wrap:wrap}
.crm-rfq-editor-field label small{color:var(--muted);font-size:11px;font-weight:400}
.crm-rfq-editor-field>div{display:flex;gap:8px;min-width:0}
.crm-rfq-editor-field .input{flex:1;min-width:0}
.crm-rfq-add-field{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.crm-rfq-add-field .input{width:min(250px,100%);min-width:0}
.crm-rfq-editor .crm-entity-error{padding:8px 0}
.crm-rfq-editor-footer{display:flex;justify-content:space-between;align-items:center;gap:12px;border-top:1px solid var(--line);padding-top:13px}
.crm-quote-reader{border-top:1px solid var(--line);padding-top:18px}
.crm-quote-detail{border:1px solid var(--line);border-radius:9px;overflow:hidden;background:var(--surface);min-width:0}
.crm-quote-detail>div:first-child{display:flex;justify-content:space-between;gap:8px;padding:13px 15px;background:var(--surface-soft,#f6f6f3)}
.crm-quote-detail>div:first-child strong{color:var(--ink);font-size:13px;overflow-wrap:anywhere}
.crm-quote-detail>div:first-child span{color:var(--muted);font-size:11px;white-space:nowrap}
.crm-quote-line{display:grid;grid-template-columns:minmax(0,1.2fr) minmax(0,1fr) auto;gap:10px;padding:11px 15px;border-top:1px solid var(--line);align-items:baseline;font-size:12px;overflow-wrap:anywhere}
.crm-quote-line strong,.crm-quote-line b{color:var(--ink)}
.crm-quote-line span{color:var(--muted)}
.crm-quote-total{display:flex;justify-content:space-between;gap:10px;padding:12px 15px;border-top:1px solid var(--line);font-size:12px;color:var(--ink)}
.crm-quote-detail>p{margin:0;padding:10px 15px;border-top:1px solid var(--line);color:var(--muted);font-size:11px;line-height:1.5}
.crm-quote-detail>.crm-entity-status{padding:12px 15px;border-top:1px solid var(--line);background:var(--surface-soft,#f6f6f3)}
.crm-quote-detail>.crm-entity-status strong{display:block;color:var(--ink);font-size:12px}
.crm-quote-detail>.crm-entity-status p{margin:5px 0 0;line-height:1.55}
.crm-quote-detail>.btn{margin:0 15px 14px}
.crm-quote-settings,.crm-quote-edit-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.crm-quote-settings label,.crm-quote-edit-line label{display:grid;gap:5px;min-width:0;color:var(--ink);font-size:12px;font-weight:600}
.crm-quote-settings .input,.crm-quote-edit-line .input,.crm-quote-editor textarea{width:100%;min-width:0}
.crm-quote-editor>.crm-entity-muted{margin:0;line-height:1.5}
.crm-quote-edit-line{display:grid;gap:12px;min-width:0;padding:15px;border:1px solid var(--line);border-radius:8px;background:var(--surface)}
.crm-quote-edit-line>div:first-child{display:flex;justify-content:space-between;align-items:center;gap:10px}
.crm-quote-edit-line>div:first-child strong{color:var(--ink);font-size:12px}
.crm-quote-editor>.btn{justify-self:start}
.crm-quote-history-detail{display:grid;gap:0;border:1px solid var(--line);border-radius:8px;overflow:hidden;background:var(--surface)}
.crm-quote-history-detail>strong{display:block;padding:11px 14px;font-size:12px;color:var(--ink);background:var(--surface-soft,#f6f6f3)}
.crm-quote-history-detail .crm-quote-line{grid-template-columns:minmax(0,1fr) auto}
@media(max-width:950px){.crm-entity-layout{grid-template-columns:minmax(0,1fr)}.crm-entity-items{display:flex;overflow-x:auto;max-height:none}.crm-entity-item{min-width:220px;border-bottom:0;border-right:1px solid var(--line)}}
@media(max-width:620px){.crm-quote-line{grid-template-columns:minmax(0,1fr) auto}.crm-quote-line span{grid-column:1/-1;grid-row:2}.crm-quote-detail>div:first-child{flex-direction:column}.crm-quote-detail>div:first-child span{white-space:normal}.crm-quote-settings,.crm-quote-edit-grid{grid-template-columns:minmax(0,1fr)}}
@media(max-width:620px){.crm-entity-page{padding-bottom:calc(108px + env(safe-area-inset-bottom,0px))}.crm-entity-heading{align-items:start;flex-direction:column}.crm-entity-entry{align-items:start;flex-direction:column}.crm-entity-entry-actions{width:100%}.crm-entity-content-grid{grid-template-columns:minmax(0,1fr)}.crm-entity-detail-head,.crm-entity-content{padding:19px}.crm-entity-company-action{padding:0 19px 18px}.crm-contact-editor{margin:0 19px 18px}.crm-opportunity-editor-grid{grid-template-columns:minmax(0,1fr)}.crm-entity-tabs{padding:0 19px}.crm-entity-list-head,.crm-entity-search{padding-left:14px;padding-right:14px}.crm-opportunity-facts{grid-template-columns:minmax(0,1fr);gap:12px}.crm-opportunity-facts>div{border-right:0;border-bottom:1px solid var(--line);padding:0 0 12px}.crm-opportunity-facts>div:last-child{border-bottom:0;padding-bottom:0}.crm-rfq-fields{grid-template-columns:minmax(0,1fr)}.crm-rfq-reader-head{flex-direction:column}.crm-rfq-head-actions{justify-content:flex-start}.crm-rfq-editor-footer{align-items:start;flex-direction:column}.crm-rfq-editor-footer .btn{width:100%}}
