/* CRM relationships: petrol for navigation and selection, gold for key actions. */
@layer crm-admin-ui {
body.crm-admin-ui:is([data-crm-route="companies.html"],[data-crm-route="company_detail.html"],[data-crm-route="contacts.html"],[data-crm-route="contact_detail.html"],[data-crm-route="contact_edit.html"],[data-crm-route="contact_forms.html"],[data-crm-route="contact_form_detail.html"],[data-crm-route="sales.html"],[data-crm-route="development.html"]) {
 --relations-link:#9dd5cf; --relations-accent-soft:#193e3e; --relations-accent-line:#4c8e88; --relations-gold:#e7cb80;
}
html.theme-light body.crm-admin-ui:is([data-crm-route="companies.html"],[data-crm-route="company_detail.html"],[data-crm-route="contacts.html"],[data-crm-route="contact_detail.html"],[data-crm-route="contact_edit.html"],[data-crm-route="contact_forms.html"],[data-crm-route="contact_form_detail.html"],[data-crm-route="sales.html"],[data-crm-route="development.html"]) {
 --relations-link:#125d60; --relations-accent-soft:#e4f1ef; --relations-accent-line:#176c70; --relations-gold:#755719;
}
body.crm-admin-ui:is([data-crm-route="companies.html"],[data-crm-route="company_detail.html"],[data-crm-route="contacts.html"],[data-crm-route="contact_detail.html"],[data-crm-route="contact_edit.html"],[data-crm-route="contact_forms.html"],[data-crm-route="contact_form_detail.html"],[data-crm-route="sales.html"],[data-crm-route="development.html"]) :is(main,.modal,dialog) :is(a:not(.crm-button),.opp-title,.proj-title,summary) { color:var(--relations-link) !important; }
body.crm-admin-ui:is([data-crm-route="sales.html"],[data-crm-route="development.html"]) :is(.kanban-col,.kanban-card,.kanban-qa,.company-suggest,.detail-section,.weighted-info .f) { background:var(--ui-panel) !important; color:var(--ui-text) !important; border-color:var(--ui-line) !important; }
body.crm-admin-ui:is([data-crm-route="sales.html"],[data-crm-route="development.html"]) :is(.kanban-col-header,.kanban-card .kc-next,.detail-section,.link-item,.activity-item,.task-item) { border-color:var(--ui-line) !important; }
body.crm-admin-ui:is([data-crm-route="sales.html"],[data-crm-route="development.html"]) :is(.stage-chip.active,.view-toggle button.active,.company-suggest-item:hover,.company-suggest-item.active,.company-suggest-create:hover,.company-suggest-create.active) { background:#176c70 !important; color:#fff !important; border-color:#176c70 !important; }
body.crm-admin-ui:is([data-crm-route="sales.html"],[data-crm-route="development.html"]) :is(.stage-chip:hover,.kanban-card:hover,.kanban-col.drag-over,.kanban-qa-btn:hover,.kanban-qa-empty-btn:hover) { border-color:var(--relations-accent-line) !important; }
body.crm-admin-ui:is([data-crm-route="sales.html"],[data-crm-route="development.html"]) :is(.stage-chip:not(.active),.view-toggle button:not(.active)) { background:var(--ui-soft) !important; color:var(--ui-text) !important; border-color:var(--ui-line) !important; }
body.crm-admin-ui:is([data-crm-route="sales.html"],[data-crm-route="development.html"]) :is(.status-open,.prospect-pill) { background:#176c70 !important; color:#fff !important; }
body.crm-admin-ui:is([data-crm-route="sales.html"],[data-crm-route="development.html"]) :is(#statValue,#statProspects,.company-suggest-create:not(:hover):not(.active)) { color:var(--relations-gold) !important; }
body.crm-admin-ui:is([data-crm-route="sales.html"],[data-crm-route="development.html"]) :is(.stat-card) { border-top:3px solid #176c70 !important; }
body.crm-admin-ui:is([data-crm-route="contact_form_detail.html"],[data-crm-route="contact_detail.html"]) :is(.info-item,.message-box) { background:var(--ui-soft) !important; border-color:var(--ui-line) !important; color:var(--ui-text) !important; }
body.crm-admin-ui[data-crm-route="company_detail.html"] :is(.product-access-badge.event,#portalReadOnlyBanner) { background:var(--relations-accent-soft) !important; color:var(--ui-text) !important; border-color:var(--relations-accent-line) !important; }
body.crm-admin-ui[data-crm-route="company_detail.html"] :is(.comm-panel,.comm-kpi,.comm-table-wrap,.comm-table-wrap table) { background:var(--ui-soft) !important; border-color:var(--ui-line) !important; color:var(--ui-text) !important; }
body.crm-admin-ui[data-crm-route="company_detail.html"] :is(.comm-meta,.comm-status,.comm-kpi .k) { color:var(--ui-muted) !important; }
body.crm-admin-ui[data-crm-route="company_detail.html"] #btnNewEvent { background:#c9a44c !important; color:#242629 !important; border-color:#c9a44c !important; }
body.crm-admin-ui[data-crm-route="contact_edit.html"] main details[open] { background:var(--ui-soft) !important; border-color:var(--relations-accent-line) !important; }
body.crm-admin-ui:is([data-crm-route="companies.html"],[data-crm-route="company_detail.html"],[data-crm-route="contacts.html"],[data-crm-route="contact_detail.html"],[data-crm-route="contact_edit.html"],[data-crm-route="contact_forms.html"],[data-crm-route="contact_form_detail.html"],[data-crm-route="sales.html"],[data-crm-route="development.html"]) main :is(input,select,textarea):focus-visible { outline:3px solid var(--ui-focus) !important; outline-offset:2px !important; border-color:var(--relations-accent-line) !important; }
}

/* Relationship workspace: visible hierarchy without adding boxes around every item. */
@layer crm-admin-ui {
  body.crm-admin-ui:is([data-crm-route="companies.html"],[data-crm-route="contacts.html"],[data-crm-route="contact_forms.html"],[data-crm-route="sales.html"],[data-crm-route="development.html"]) {
    --relations-band:#193e3e; --relations-band-text:#d9eeeb;
  }
  html.theme-light body.crm-admin-ui:is([data-crm-route="companies.html"],[data-crm-route="contacts.html"],[data-crm-route="contact_forms.html"],[data-crm-route="sales.html"],[data-crm-route="development.html"]) {
    --relations-band:#e4f1ef; --relations-band-text:#164d4e;
  }
  /* Section labels are aligned with the travel overview's petrol month headings. */
  html body.crm-admin-ui:is([data-crm-route="companies.html"],[data-crm-route="contact_forms.html"],[data-crm-route="sales.html"],[data-crm-route="development.html"]) main :is(table:not(.stages-table) thead th) {
    background:var(--relations-band) !important; color:var(--relations-band-text) !important;
    border-bottom:1px solid var(--relations-accent-line) !important;
  }
  html body.crm-admin-ui:is([data-crm-route="companies.html"],[data-crm-route="contact_forms.html"],[data-crm-route="sales.html"],[data-crm-route="development.html"]) main table:not(.stages-table) tbody tr:hover td {
    background:var(--ui-soft) !important;
  }
  html body.crm-admin-ui:is([data-crm-route="companies.html"],[data-crm-route="sales.html"],[data-crm-route="development.html"]) main :is(.mini-stat,.stat-card) {
    border-top:3px solid var(--ui-petrol) !important;
    background:var(--ui-soft) !important;
  }
  html body.crm-admin-ui:is([data-crm-route="companies.html"],[data-crm-route="sales.html"],[data-crm-route="development.html"]) main :is(.mini-stat:nth-child(2),.stat-card:nth-child(2)) { border-top-color:var(--ui-gold) !important; }
  html body.crm-admin-ui:is([data-crm-route="companies.html"],[data-crm-route="sales.html"],[data-crm-route="development.html"]) main :is(.mini-stat:nth-child(2) .v,#statValue,#statInvestment,#statProspects) { color:var(--relations-gold) !important; }
  html body.crm-admin-ui[data-crm-route="companies.html"] main .signal-chip:is(.info,.neutral) {
    background:var(--relations-band) !important; color:var(--relations-band-text) !important; border-color:var(--relations-accent-line) !important;
  }
  html body.crm-admin-ui[data-crm-route="contact_forms.html"] main > section.card:last-of-type { overflow-x:auto !important; }
  html body.crm-admin-ui[data-crm-route="contact_forms.html"] main > section.card:last-of-type table { min-width:900px; }
  /* Clear separation between controls, board columns and their content. */
  html body.crm-admin-ui:is([data-crm-route="sales.html"],[data-crm-route="development.html"]) main .toolbar {
    display:flex !important; gap:10px !important; padding:0 0 14px !important;
    margin-bottom:14px !important; border-bottom:1px solid var(--ui-line) !important; border-radius:0 !important;
    background:transparent !important;
  }
  html body.crm-admin-ui:is([data-crm-route="sales.html"],[data-crm-route="development.html"]) main :is(.stage-chip.active,.view-toggle button.active) {
    background:#176c70 !important; color:#fff !important; border-color:#176c70 !important;
  }
  html body.crm-admin-ui:is([data-crm-route="sales.html"],[data-crm-route="development.html"]) main :is(.kanban-col) {
    background:var(--ui-soft) !important; border:0 !important; border-radius:6px !important; box-shadow:none !important;
  }
  html body.crm-admin-ui:is([data-crm-route="sales.html"],[data-crm-route="development.html"]) main .kanban-col-header {
    background:var(--relations-band) !important; color:var(--relations-band-text) !important;
    border-left:4px solid var(--ui-petrol) !important; border-bottom:0 !important; border-radius:4px !important;
  }
  html body.crm-admin-ui:is([data-crm-route="sales.html"],[data-crm-route="development.html"]) main :is(.kanban-col-title,.kanban-col-title .n,.kanban-col-sum) { color:var(--relations-band-text) !important; }
  html body.crm-admin-ui:is([data-crm-route="sales.html"],[data-crm-route="development.html"]) main .kanban-card {
    background:var(--ui-panel) !important; border:0 !important; border-left:3px solid var(--ui-petrol) !important;
    border-radius:4px !important; box-shadow:none !important;
  }
  html body.crm-admin-ui:is([data-crm-route="sales.html"],[data-crm-route="development.html"]) main .kanban-card:hover { border-left-color:var(--ui-gold) !important; }
  html body.crm-admin-ui:is([data-crm-route="sales.html"],[data-crm-route="development.html"]) main :is(.kc-value,.kc-investment) { color:var(--relations-gold) !important; }
  html body.crm-admin-ui:is([data-crm-route="sales.html"],[data-crm-route="development.html"]) main :is(.kc-company,.kc-meta,.stat-label) { color:var(--ui-muted) !important; }
  html body.crm-admin-ui[data-crm-route="companies.html"] main .mini-stat .k { color:var(--ui-muted) !important; }
  html body.crm-admin-ui:is([data-crm-route="sales.html"],[data-crm-route="development.html"]) main .table-wrap { border:0 !important; border-radius:4px !important; }
  html body.crm-admin-ui:is([data-crm-route="sales.html"],[data-crm-route="development.html"]) main table td { padding:12px 10px !important; }
  @media (max-width:700px) {
    html body.crm-admin-ui:is([data-crm-route="sales.html"],[data-crm-route="development.html"]) main .toolbar > :is(select,input) { flex:1 1 140px; min-width:0 !important; }
    html body.crm-admin-ui:is([data-crm-route="sales.html"],[data-crm-route="development.html"]) main .toolbar .spacer { display:none; }
    html body.crm-admin-ui:is([data-crm-route="sales.html"],[data-crm-route="development.html"]) main .kanban-col { max-height:none; }
  }
}

/* The contacts pilot has its own component layer; target only this workspace. */
@layer crm-pilot {
  html body.crm-admin-ui.crm-admin-pilot[data-crm-route="contacts.html"] #contactsMain .crm-list-toolbar {
    background:var(--relations-band) !important; border-left:4px solid var(--ui-petrol) !important;
    border-bottom:1px solid var(--relations-accent-line) !important;
  }
  html body.crm-admin-ui.crm-admin-pilot[data-crm-route="contacts.html"] #contactsMain .crm-list-title :is(h2,svg,#filterMeta) { color:var(--relations-band-text) !important; }
  html body.crm-admin-ui.crm-admin-pilot[data-crm-route="contacts.html"] #contactsMain .crm-filters { padding-top:16px !important; }
  html body.crm-admin-ui.crm-admin-pilot[data-crm-route="contacts.html"] #contactsMain .crm-contacts-table thead th {
    background:var(--relations-band) !important; color:var(--relations-band-text) !important; border-bottom:1px solid var(--relations-accent-line) !important;
  }
  html body.crm-admin-ui.crm-admin-pilot[data-crm-route="contacts.html"] :is(#contactsMain,#contactFormLayer) .crm-primary {
    background:#c9a44c !important; color:#242629 !important; border-color:#c9a44c !important;
  }
}

/* Gold identifies actions without obscuring destructive controls. */
@layer crm-pilot {
  html body.crm-admin-ui.crm-admin-pilot[data-crm-route="contacts.html"] #contactsMain :is(#btnAdd,.crm-row-actions [data-view]) { background:#c9a44c !important; border-color:#c9a44c !important; color:#242629 !important; }
  html body.crm-admin-ui.crm-admin-pilot[data-crm-route="contacts.html"] #contactsMain .crm-row-actions [data-edit] { background:var(--crm-panel) !important; border:1px solid var(--crm-line) !important; color:var(--crm-text) !important; }
  html body.crm-admin-ui.crm-admin-pilot[data-crm-route="contacts.html"] #contactsMain .crm-row-actions { gap:8px !important; justify-content:flex-end !important; }
  html body.crm-admin-ui.crm-admin-pilot[data-crm-route="contacts.html"] #contactsMain .crm-row-actions .crm-button { padding:6px 10px !important; }
  html body.crm-admin-ui.crm-admin-pilot[data-crm-route="contacts.html"] #contactsMain .crm-contacts-table :is(th,td):last-child { text-align:right !important; }
}
@layer crm-admin-ui {
  html body.crm-admin-ui[data-crm-route="contact_forms.html"] main :is(#btnReload,button[data-view],button[data-open],button[onclick*="viewForm"],a[data-view]) { background:#c9a44c !important; color:#242629 !important; border-color:#c9a44c !important; }
  html body.crm-admin-ui[data-crm-route="contact_forms.html"] main :is(button:not(.danger),a.button):hover { border-color:#c9a44c !important; }
}
