/* Search CRM typography and surfaces: visual only, loaded last.
   No markup, behaviour or meaning changes: stage colours, full names and
   every information element stay exactly as defined by app.css/theme.css. */
:root{--sc-ink:#101828;--sc-text:#1d2939;--sc-muted:#667085;--sc-border:#e4e7ec;--sc-page:#f5f7fa;--sc-surface:#fff;--sc-accent:var(--brand-accent);--sc-accent-hover:var(--brand-accent-hover);--sc-accent-soft:var(--brand-accent-soft);--sc-radius:8px;
--crm-detail-label-size:12px;--crm-detail-value-size:13px;--crm-filter-surface:#fff;--crm-table-header-surface:#f9fafb}
html[data-theme="dark"]{--sc-ink:#f2f4f7;--sc-text:#e4e7ec;--sc-muted:#98a2b3;--sc-border:#2e3744;--sc-page:#0f141a;--sc-surface:#171d24}
html,body,button,input,select,textarea{font-family:"Inter","SF Pro Text",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif}
body{font-size:13px;color:var(--sc-text);background:var(--sc-page)!important;-webkit-font-smoothing:antialiased}
h1{font-size:20px!important;font-weight:650;letter-spacing:-.01em;line-height:1.25;color:var(--sc-ink)}
h2{font-size:15px;font-weight:600;letter-spacing:-.005em}
.crm-global-header{background:var(--sc-surface);border-bottom:1px solid var(--sc-border);box-shadow:none}
.crm-global-header nav a{font-size:13px;font-weight:500;color:var(--sc-muted)}
.crm-global-header nav a.active,.crm-global-header nav a:hover{color:var(--sc-ink)}
.crm-page-head{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:8px 16px;margin-bottom:12px}
.crm-page-head h1{margin:0}
.crm-page-actions{display:flex;gap:8px;margin:0}
.crm-page-actions .button,.crm-page-head>.button{width:auto!important;flex:0 0 auto}
.button.primary,button.primary{background:var(--sc-accent);border:1px solid var(--sc-accent);color:#fff;border-radius:var(--sc-radius);font-size:13px;font-weight:600;min-height:32px;padding:6px 14px;box-shadow:0 1px 2px rgb(16 24 40/8%)}
.button.primary:hover,button.primary:hover{background:var(--sc-accent-hover);border-color:var(--sc-accent-hover)}
.panel,.crm-list-filterbar{background:var(--sc-surface);border:1px solid var(--sc-border)!important;border-radius:10px;box-shadow:none}
input:not([type=checkbox]):not([type=radio]),select,textarea{border:1px solid var(--sc-border);border-radius:var(--sc-radius);font-size:13px}
input:focus,select:focus,textarea:focus{outline:none;border-color:var(--sc-accent)!important;box-shadow:0 0 0 3px rgb(0 170 154/15%)!important}
label,dt{font-size:12px}
.crm-table-wrap{border:1px solid var(--sc-border);border-radius:10px;overflow:auto;background:var(--sc-surface)}
.crm-table th{font-size:12px;font-weight:600;color:var(--sc-muted);background:var(--crm-table-header-surface);text-transform:none;letter-spacing:0}
.crm-table td{font-size:13px;border-color:var(--sc-border)}
.crm-table tbody tr:hover>td{background:rgb(0 170 154/4%)}
.crm-section-entity-nav{display:flex;justify-content:flex-end}
.crm-entity-matrix{display:inline-flex!important;flex-wrap:nowrap;grid-template-columns:none!important;gap:2px;padding:3px;background:var(--sc-page);border:1px solid var(--sc-border);border-radius:9px;width:auto!important}
.crm-entity-matrix>*{background:transparent!important;color:var(--sc-muted)!important;border:0!important;border-radius:6px!important;font-size:12px!important;font-weight:500!important;text-transform:none!important;letter-spacing:0!important;min-height:0!important;height:auto!important;padding:5px 12px!important;box-shadow:none!important;width:auto!important}
.crm-entity-matrix>.active{background:var(--sc-surface)!important;color:var(--sc-ink)!important;box-shadow:0 1px 2px rgb(16 24 40/12%)!important}
.crm-entity-matrix>a:hover{color:var(--sc-ink)!important}
.crm-deal-command-row{display:flex!important;flex-wrap:wrap;gap:8px;grid-template-columns:none!important}
.crm-deal-command-row>*{flex:0 0 auto!important;width:auto!important}
.crm-deal-hero{border:1px solid var(--sc-border);border-radius:10px;box-shadow:none;background:var(--sc-surface)}
.crm-record-tabs{display:flex;gap:4px;border-bottom:1px solid var(--sc-border);background:transparent;padding:0;border-radius:0}
.crm-record-tabs button{background:transparent!important;color:var(--sc-muted)!important;border:0!important;border-bottom:2px solid transparent!important;border-radius:0!important;font-size:13px;font-weight:500;padding:8px 12px;margin-bottom:-1px}
.crm-record-tabs button:hover{color:var(--sc-ink)!important}
.crm-record-tabs button.active{color:var(--sc-ink)!important;border-bottom-color:var(--sc-accent)!important;font-weight:600}
.crm-record-tabs button span{color:var(--sc-muted);font-weight:500;margin-left:2px}
.crm-small-command{border:1px solid var(--sc-border);border-radius:var(--sc-radius);background:var(--sc-surface);color:var(--sc-text);font-size:12.5px;font-weight:500;min-height:30px;padding:5px 10px;box-shadow:none}
.crm-small-command:hover{border-color:#cfd4dc;background:#f9fafb}
.crm-small-command.primary{background:var(--sc-accent);border-color:var(--sc-accent);color:#fff}
.crm-icon-button{border-color:var(--sc-border)!important}
.crm-compact-section,.crm-entity-panel>section{border-color:var(--sc-border);border-radius:10px}
.crm-compact-section>header h2{font-size:14px}
.crm-brand strong{font-size:15px!important;line-height:1.1}
.crm-company-table td{vertical-align:middle;padding-top:10px;padding-bottom:10px}
.crm-company-table th:nth-child(3),.crm-company-table td:nth-child(3){min-width:320px}
.crm-company-table td:nth-child(2){max-width:260px;min-width:180px}
.crm-company-table .crm-holding-link{font-size:12px!important;font-weight:400!important;color:var(--sc-muted)!important;line-height:1.35}
.crm-company-table .crm-company-title-line a{font-size:13px!important;font-weight:600!important;color:var(--sc-ink)!important;line-height:1.35}
.crm-company-table td small{font-size:11.5px;color:var(--sc-muted)}
.crm-company-table .crm-head-company-badge img{width:12px;height:12px;opacity:.75}
.crm-company-table td:nth-child(4){font-variant-numeric:tabular-nums}
/* status chips: shape only; each stage keeps its own meaning colour */
.crm-status{border-radius:999px!important;font-size:11.5px!important;font-weight:500!important;padding:2px 8px!important;border:0!important}
.crm-tab-panel section>header>div>span:first-child{text-transform:none!important;letter-spacing:0!important;font-size:11.5px!important;font-weight:500!important;color:var(--sc-muted)!important}
.crm-tab-panel section>header h2{font-size:14px!important;font-weight:600!important;margin:0!important}
.crm-deal-products-panel{border:1px solid var(--sc-border);border-radius:10px;background:var(--sc-surface);padding:12px 14px}
.crm-deal-products-panel form{display:flex!important;align-items:center;gap:8px;flex-wrap:wrap}
.crm-deal-products-panel form label{display:flex;align-items:center;gap:8px;margin:0;flex:1 1 320px;max-width:460px;font-size:12px;color:var(--sc-muted)}
.crm-deal-products-panel form label select,.crm-deal-products-panel form select{flex:1;width:auto!important;margin:0!important}
.crm-deal-products-panel form button{margin:0!important;min-height:34px}
.crm-tab-panel>section+section{margin-top:12px}
.crm-reference-contact-list{display:grid;gap:8px}
.contact-inline-record{border:1px solid var(--sc-border);border-radius:10px;padding:12px 14px;background:var(--sc-surface)}
.contact-inline-record>header{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-bottom:8px}
.contact-inline-record>header strong{font-size:14px;font-weight:600;color:var(--sc-ink)}
.contact-primary-badge,.contact-inline-record>header span{border-radius:999px;background:var(--sc-accent-soft);color:var(--brand-accent-strong);font-size:11.5px;font-weight:500;padding:2px 8px}
.contact-inline-record>header .contact-inline-icon{margin-left:auto}
.contact-inline-data{display:grid!important;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:2px 16px;margin:0}
.contact-inline-data dt{font-size:11.5px!important;font-weight:500!important;color:var(--sc-muted)!important;border:0!important;padding:0!important}
.contact-inline-data dd{margin:0 0 6px!important;font-size:13px!important;border:0!important;padding:0!important}
.crm-reference-contact-list>div{display:flex;gap:16px;align-items:baseline;padding:8px 14px;border:1px solid var(--sc-border);border-radius:8px;background:var(--sc-surface)}
.crm-reference-contact-list>div strong{min-width:150px;font-size:12px;font-weight:500;color:var(--sc-muted)}
.crm-reference-contact-list>div span{color:var(--sc-text);font-size:13px}
details.deal-contact-add>summary{min-height:30px;font-size:12.5px}
.analytics-eyebrow,.analytics-panel header span:first-child:not(:only-child){text-transform:none!important;letter-spacing:0!important;font-size:11.5px!important;font-weight:500!important;color:var(--sc-muted)!important}
.analytics-panel,.analytics-kpis{border-color:var(--sc-border)!important;border-radius:10px!important;box-shadow:none!important}
.operations-head h1{font-size:20px!important}
/* phones: one-line scrollable menus, tables scroll inside their card */
@media (max-width:640px){
.crm-global-row{gap:8px;min-width:0}
.crm-brand{flex:0 0 auto}
.crm-global-nav,.crm-subnav,.test-subnav,.crm-section-entity-nav{display:flex;flex-wrap:nowrap;overflow-x:auto;overscroll-behavior-x:contain;scrollbar-width:none;min-width:0;-webkit-overflow-scrolling:touch}
.crm-global-nav::-webkit-scrollbar,.crm-subnav::-webkit-scrollbar,.test-subnav::-webkit-scrollbar,.crm-section-entity-nav::-webkit-scrollbar{display:none}
.crm-global-nav a,.crm-subnav a,.test-subnav a,.crm-section-entity-nav a{white-space:nowrap;flex:0 0 auto}
.crm-global-nav{flex:1 1 auto}
.crm-section-row{max-width:100vw;overflow:hidden}
.statistics-page,.work-funnel-page,.activities-page{max-width:100%;min-width:0}
.statistics-page table,.work-funnel-page table{display:block;max-width:100%;overflow-x:auto}
}

/* dark theme: elements that kept their light-theme fills — section headers and filter lists were light text on light,
   chips and badges were bright; the same hues muted with transparency, nothing changes in the light theme */
html[data-theme="dark"] .crm-compact-section>header{border-bottom-color:var(--dark-border);background:var(--dark-soft)}
html[data-theme="dark"] .crm-compact-section>header p{color:var(--dark-muted)}
html[data-theme="dark"] .activities-multiselect label{color:var(--dark-text)}
html[data-theme="dark"] .instant-multiselect-tools{border-bottom-color:var(--dark-border);background:var(--dark-elevated)}
html[data-theme="dark"] .instant-multiselect-tools input[type="search"]{border-color:var(--dark-border);background:var(--dark-surface);color:var(--dark-text)}
html[data-theme="dark"] .instant-multiselect-reset{color:var(--dark-muted)}
html[data-theme="dark"] .crm-search-submit-button{border-color:var(--dark-border);background:var(--dark-soft);color:var(--dark-text)}
html[data-theme="dark"] .crm-search-submit-button:hover{border-color:#46525f;background:#2a3440;color:var(--dark-text)}
html[data-theme="dark"] .pull-refresh-indicator{border-color:var(--dark-border);background:var(--dark-elevated);color:var(--dark-muted)}
html[data-theme="dark"] :is(.planner-cell-count,.planner-no-step>header span){background:#303b47;color:#c4ced8}
html[data-theme="dark"] .task-history-state{color:var(--dark-muted)}
html[data-theme="dark"] .task-history-state.planned{background:var(--dark-soft)}
html[data-theme="dark"] .task-history-state.rescheduled{background:rgb(214 170 60/22%)}
html[data-theme="dark"] .task-history-state.completed{background:rgb(64 170 110/20%)}
html[data-theme="dark"] :is(.task-history-state.not_completed,.task-history-state.no_answer){background:rgb(190 70 90/22%)}
html[data-theme="dark"] .task-count.future{background:rgb(64 170 110/20%);color:#8fd3a8}
html[data-theme="dark"] .task-count.today{background:rgb(214 170 60/22%);color:#e3c06a}
html[data-theme="dark"] .task-count.overdue{background:rgb(190 70 90/24%);color:#f0a0ae}
html[data-theme="dark"] .communication-report-control{border-color:var(--dark-border);background:var(--dark-surface)}
html[data-theme="dark"] .communication-report-control>.communication-report-trigger{color:var(--dark-text)}
html[data-theme="dark"] .communication-report-control>:is(.communication-report-trigger,.communication-report-refresh):hover:not(:disabled){background:var(--dark-soft)}
html[data-theme="dark"] .communication-report-control>.communication-report-refresh{border-left-color:var(--dark-border)}
html[data-theme="dark"] .communication-report-control:has(>.communication-report-trigger.is-ready){border-color:rgb(32 193 177/45%)}
html[data-theme="dark"] .communication-report-trigger.is-ready [data-communication-report-label]{color:#70ddd3}
html[data-theme="dark"] .communication-report-trigger-copy small{color:var(--dark-muted)}
html[data-theme="dark"] .communication-report-trigger.is-running{color:var(--dark-muted)}
html[data-theme="dark"] .communication-report-trigger.is-error [data-communication-report-label]{color:#f0a0ae}
html[data-theme="dark"] .crm-mode :is(.crm-work-role-badge,.crm-access-badge,.crm-metric-icon){background:var(--dark-soft);color:#c4ced8}
html[data-theme="dark"] .crm-mode :is(.crm-metric-icon.total,.crm-metric-icon.admin,.crm-work-role-badge.hunter){background:rgb(52 119 223/20%);color:#8fb6f2}
html[data-theme="dark"] .crm-mode .crm-metric-icon.hunter{background:rgb(32 161 87/20%);color:#79cf9c}
html[data-theme="dark"] .crm-mode :is(.crm-metric-icon.farmer,.crm-work-role-badge.farmer,.crm-access-badge.admin){background:rgb(230 122 29/20%);color:#f0aa6c}
html[data-theme="dark"] .crm-mode .crm-metric-icon.super{background:rgb(138 75 209/22%);color:#bf9bf0}
html[data-theme="dark"] .crm-mode .crm-access-badge.super_admin{background:rgb(211 76 85/22%);color:#f0a0a6}
html[data-theme="dark"] :is(.project-dictionary-add,.project-copy-actions) button{border-color:var(--brand-accent-soft-strong);background:var(--brand-accent-soft);color:var(--brand-accent-strong)}

/* entity pages: the back link sits above the title, which starts at the left edge */
.crm-compact-entity-head .crm-back{display:block;width:fit-content;margin:0 0 6px}
.crm-compact-entity-head .crm-company-page-title{display:flex}
/* entity toolbar: report groups and commands share one height */
.crm-compact-toolbar{align-items:stretch}
.crm-compact-toolbar .crm-small-command{display:inline-flex;align-items:center;min-height:38px}
/* deal tasks header: title, counter and «Новая задача» on the first line, the report groups below without the date */
.deal-task-heading{flex-wrap:wrap;row-gap:10px}
.deal-task-heading .communication-report-controls{order:3;flex-basis:100%}
.deal-task-heading .communication-report-trigger-copy small{display:none}
/* the sales type chip is a pill like the deal status, everywhere */
.crm-sales-channel{min-height:0;padding:2px 9px;border-radius:999px;font-size:11.5px;font-weight:500;line-height:1.4}
/* deals list: the typography and pill chips of the companies list */
.crm-reference-deals-table .crm-deal-list-summary,.crm-reference-deals-table .crm-deal-list-summary :is(strong,.crm-deal-primary-label){font-size:13px;font-weight:600}
.crm-reference-deals-table :is(.crm-deal-list-summary,.crm-company-title-line) small,.crm-reference-deals-table time small{font-size:11.5px;font-weight:400;color:var(--sc-muted)}
.crm-reference-deals-table .crm-client-link{font-size:13px;font-weight:600}
.crm-reference-deals-table :is(.crm-product-tag,.company-tag-badge,.crm-sales-channel){min-height:0;padding:2px 9px;border-radius:999px;font-size:11.5px;font-weight:500;line-height:1.4}
.crm-reference-deals-table :is(.crm-person-name,time){font-size:12px}
/* the entity switch sits on the vertical centre of the section tabs (their row is 56px, text centred) */
@media (min-width:761px){.app-global-header .crm-section-row.has-entity-matrix .crm-section-entity-nav{align-self:flex-start;align-items:center;min-height:56px}}
/* «Открыть следующую компанию»: as tall as the filter fields, one line, level with them */
@media (min-width:1101px){.queue-toolbar .queue-next-action{flex:0 0 auto;align-self:flex-start;align-items:flex-start;margin:0;padding:29px 0 0}}
.queue-next-action .primary{width:auto;min-height:38px;height:38px;padding:0 18px;font-size:13px;font-weight:600;line-height:1;white-space:nowrap;border-radius:var(--sc-radius)}
@media (max-width:1100px){.queue-next-action .primary{width:min(100%,260px)}}
