/* D1: legacy shell only. Approved funnel/list and registry forms are excluded. */
body.crm-legacy-pilot {
  --workspace-accent: var(--onex-op-crm, #0078d4);
  --workspace-tint: #e8f3fc;
  --blue: var(--onex-op-crm, #0078d4);
  --blue-strong: #005a9e;
  --blue-soft: #e8f3fc;
  --text: var(--onex-op-ink, #24354a);
  --muted: var(--onex-op-muted, #586b80);
  --line: var(--onex-op-line, #dde5ef);
  --shadow: 0 2px 8px #00205008;
  color: var(--text);
  font-family: 'Segoe UI', system-ui, sans-serif;
}
.crm-legacy-pilot .workspace { padding:16px 20px; }
.crm-legacy-pilot .legacy-commandbar {
  min-width:0; display:flex; align-items:center; justify-content:space-between;
  flex-wrap:wrap; gap:12px 20px; padding:12px 16px; margin:0 0 12px;
  background:#fff; border:1px solid var(--line); border-radius:6px;
}
.crm-legacy-pilot .legacy-commandbar > div:first-child {min-width:0;}
.crm-legacy-pilot .legacy-commandbar h1 {margin:0;font-size:24px;line-height:1.3;color:var(--onex-op-navy,#002050);font-weight:650;}
.crm-legacy-pilot .legacy-commandbar .legacy-description {margin:4px 0 0;font-size:12px;line-height:1.5;color:var(--muted);}
.crm-legacy-pilot .legacy-commands {display:flex;align-items:center;gap:10px;flex-wrap:wrap;min-width:0;margin-left:auto;}
.crm-legacy-pilot .legacy-commands .object-actions {display:flex;gap:8px;flex-wrap:wrap;margin:0;}
.crm-legacy-pilot .legacy-commands .top-search {display:block;width:260px;min-width:0;max-width:100%;margin:0;height:36px;background:#fff;color:var(--text);border:1px solid var(--line);border-radius:5px;padding:8px 10px;font:12px 'Segoe UI',system-ui,sans-serif;}
.crm-legacy-pilot .workspace button {font-family:inherit;border-radius:5px;}
.crm-legacy-pilot .legacy-commandbar button,.crm-legacy-pilot .workspace>.filters button {min-height:36px;padding:8px 12px;font-size:12px;line-height:1.4;}
.crm-legacy-pilot .workspace button.primary {background:var(--blue);border-color:var(--blue);color:white;}
.crm-legacy-pilot .workspace button.primary:hover {background:var(--blue-strong);border-color:var(--blue-strong);}
.crm-legacy-pilot .workspace button:disabled {cursor:not-allowed;}
.crm-legacy-pilot .legacy-command-icon {width:16px;height:16px;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;fill:none;flex-shrink:0;}
.crm-legacy-pilot .legacy-commandbar [data-action=new-lead] {display:inline-flex;align-items:center;justify-content:center;gap:7px;}
.crm-legacy-pilot .workspace>.metric-strip {display:grid;grid-template-columns:repeat(6,minmax(0,1fr));background:#fff;border:1px solid var(--line);border-radius:6px;margin:0 0 12px;box-shadow:none;overflow:visible;}
.crm-legacy-pilot .workspace>.metric-strip>.metric {min-width:0;padding:10px 12px;border-right:1px solid var(--line);color:var(--text);background:none;}
.crm-legacy-pilot .workspace>.metric-strip>.metric:last-child {border-right:0;}
.crm-legacy-pilot .workspace>.metric-strip small {color:var(--muted);font:600 11px/1.4 'Segoe UI',system-ui,sans-serif;letter-spacing:0;text-transform:none;white-space:normal;}
.crm-legacy-pilot .workspace>.metric-strip strong {display:block;margin-top:4px;color:var(--onex-op-navy,#002050);font-size:18px;line-height:1.4;overflow-wrap:anywhere;}
.crm-legacy-pilot .workspace>.filters {display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin:0 0 12px;padding:10px 12px;background:#fff;border:1px solid var(--line);border-radius:6px;}
.crm-legacy-pilot .workspace>.filters select {flex:1 1 150px;min-width:0;max-width:100%;height:36px;border:1px solid var(--line);border-radius:5px;background:white;color:var(--text);font:12px 'Segoe UI',system-ui,sans-serif;padding:6px 10px;}
.crm-legacy-pilot .content-card {background:#fff;border:1px solid var(--line);border-radius:6px;box-shadow:none;}
.crm-legacy-pilot .content-card h2,.crm-legacy-pilot .content-card h3 {color:var(--onex-op-navy,#002050);}
.crm-legacy-pilot .pilot-submenu button.active {color:var(--workspace-accent);background:var(--workspace-tint);box-shadow:inset 3px 0 var(--workspace-accent);}
.crm-legacy-pilot.pilot-collapsed .pilot-nav {overflow:visible;z-index:40;}
.crm-legacy-pilot.pilot-collapsed .pilot-submenu:not([hidden]) {position:fixed;left:64px;width:210px;max-height:calc(100dvh - 100px);overflow:auto;padding:8px;background:white;border:1px solid var(--line);border-radius:5px;box-shadow:0 8px 24px #00205020;z-index:45;}
.crm-legacy-pilot input:focus-visible,.crm-legacy-pilot select:focus-visible,.crm-legacy-pilot textarea:focus-visible,.crm-legacy-pilot button:focus-visible {outline:3px solid var(--workspace-accent);outline-offset:2px;}
@media(max-width:1100px){
 .crm-legacy-pilot .workspace>.metric-strip {grid-template-columns:repeat(3,minmax(0,1fr));}
 .crm-legacy-pilot .workspace>.metric-strip>.metric {border-bottom:1px solid var(--line);}
 .crm-legacy-pilot .workspace>.metric-strip>.metric:nth-child(3n) {border-right:0;}
 .crm-legacy-pilot .workspace>.metric-strip>.metric:nth-last-child(-n+3) {border-bottom:0;}
}
@media(max-width:700px){
 .crm-legacy-pilot .workspace {padding:12px;}
 .crm-legacy-pilot .legacy-commandbar {padding:12px;align-items:flex-start;}
 .crm-legacy-pilot .legacy-commandbar h1 {font-size:22px;}
 .crm-legacy-pilot .legacy-commands {width:100%;margin:0;gap:8px;}
 .crm-legacy-pilot .legacy-commands .top-search {display:block;width:100%;flex:1 1 100%;}
 .crm-legacy-pilot .legacy-commands .object-actions {width:100%;}
 .crm-legacy-pilot .legacy-commands .object-actions>button {flex:1;}
 .crm-legacy-pilot .workspace>.metric-strip {grid-template-columns:repeat(2,minmax(0,1fr));}
 .crm-legacy-pilot .workspace>.metric-strip>.metric {border-right:1px solid var(--line);border-bottom:1px solid var(--line);}
 .crm-legacy-pilot .workspace>.metric-strip>.metric:nth-child(2n) {border-right:0;}
 .crm-legacy-pilot .workspace>.metric-strip>.metric:nth-last-child(-n+2) {border-bottom:0;}
 .crm-legacy-pilot .workspace>.filters select {flex-basis:calc(50% - 8px);}
 .crm-legacy-pilot .workspace>.filters button {width:100%;}
 .crm-legacy-pilot.pilot-collapsed .pilot-submenu:not([hidden]),.crm-legacy-pilot .pilot-submenu:not([hidden]) {left:12px;right:12px;top:114px!important;width:auto;max-height:50dvh;}
}

/* D1 Tarefas: keep the agenda heading and counters inside narrow workspaces.
   This markup is exclusive to renderTasks; other legacy screens are unaffected. */
@media (max-width:900px) {
 .crm-legacy-pilot .agenda-head {flex-wrap:wrap;align-items:flex-start;}
 .crm-legacy-pilot .agenda-head > div:first-child {flex:1 1 100%;min-width:0;}
 .crm-legacy-pilot .agenda-head p {font-size:13px;line-height:1.5;}
 .crm-legacy-pilot .agenda-kpis {width:100%;min-width:0;grid-template-columns:repeat(3,minmax(0,1fr));}
 .crm-legacy-pilot .agenda-kpis article {min-width:0;padding:8px;}
 .crm-legacy-pilot .agenda-kpis small {font-size:11px;letter-spacing:0;overflow-wrap:anywhere;}
}

/* D1 final: auxiliary screens only. Core funnel/list/registries are excluded. */
.crm-legacy-pilot .workspace > .content-card {min-width:0;}
.crm-legacy-pilot .content-card :is(h2,h3) {line-height:1.35;}
.crm-legacy-pilot :is(.report-head,.marketing-context,.formalization-toolbar,.settings-head) {min-width:0;flex-wrap:wrap;gap:12px;}
.crm-legacy-pilot :is(.report-head,.marketing-context,.formalization-toolbar,.settings-head) > div {min-width:0;}
.crm-legacy-pilot :is(.report-actions,.marketing-context-actions,.import-actions) {flex-wrap:wrap;gap:8px;min-width:0;}
.crm-legacy-pilot :is(.import-card,.settings-card,.report-card,.report-head,.report-table-card,.marketing-context,.campaign-panel,.intel-products,.prospecting-builder,.prospecting-results) {border-radius:6px;border-color:var(--line);box-shadow:none;min-width:0;}
.crm-legacy-pilot :is(input,select,textarea) {max-width:100%;min-width:0;font-family:inherit;}
.crm-legacy-pilot .formalization-summary {grid-template-columns:repeat(5,minmax(0,1fr));}
.crm-legacy-pilot .formalization-card {min-width:0;overflow-wrap:anywhere;}
.crm-legacy-pilot .legacy-results-note {font-size:12px;color:var(--muted);line-height:1.5;margin:0 0 12px;}
.crm-legacy-pilot [role="region"]:focus-visible,.crm-legacy-pilot a:focus-visible,.crm-legacy-pilot summary:focus-visible {outline:3px solid var(--workspace-accent);outline-offset:-3px;}
.crm-legacy-pilot .report-table-card {overflow-x:auto;}
.crm-legacy-pilot .intelligence-journey {flex-wrap:wrap;}
.crm-legacy-pilot .intelligence-journey button {min-width:0;white-space:normal;}
@media(max-width:1100px){
 .crm-legacy-pilot .formalization-summary {grid-template-columns:repeat(3,minmax(0,1fr));}
}
@media(max-width:700px){
 .crm-legacy-pilot :is(.report-head,.marketing-context) {flex-direction:column;align-items:stretch;}
 .crm-legacy-pilot :is(.report-actions,.marketing-context-actions) {width:100%;justify-content:flex-start;}
 .crm-legacy-pilot .report-actions input {width:100%;}
 .crm-legacy-pilot :is(.report-actions,.marketing-context-actions) button {flex:1 1 auto;min-height:36px;}
 .crm-legacy-pilot .formalization-summary {grid-template-columns:repeat(2,minmax(0,1fr));}
 .crm-legacy-pilot .formalization-card {padding:10px;}
 .crm-legacy-pilot .intelligence-journey {display:grid;grid-template-columns:1fr;}
 .crm-legacy-pilot .intelligence-journey button {width:100%;justify-content:flex-start;}
 .crm-legacy-pilot :is(.intel-shell,.marketing-shell,.report-page) {padding:12px;}
 .crm-legacy-pilot .settings-row {overflow-wrap:anywhere;}
 .crm-legacy-pilot .workspace>.filters select {flex-basis:100%;}
 .crm-legacy-pilot .legacy-commands .object-actions>button {min-width:0;white-space:normal;}
}

@media(max-width:1100px){
 .crm-legacy-pilot .marketing-heading {flex-wrap:wrap;}
 .crm-legacy-pilot .brevo-connection {max-width:100%;min-width:0;flex-wrap:wrap;overflow-wrap:anywhere;}
 .crm-legacy-pilot .brevo-connection > * {min-width:0;white-space:normal;}
}
.crm-legacy-pilot .import-grid {grid-template-columns:repeat(auto-fit,minmax(min(100%,280px),1fr));}
@media(min-width:701px) and (max-width:1100px){
 .crm-legacy-pilot .settings-table {overflow-x:auto;}
 .crm-legacy-pilot .settings-row {min-width:760px;}
}
.crm-legacy-pilot .settings-row[hidden],.crm-legacy-pilot .legacy-commands:empty {display:none;}

.crm-legacy-pilot [role=button]:focus-visible {outline:3px solid var(--workspace-accent);outline-offset:2px;}

.crm-legacy-pilot .formalization-board td {vertical-align:top;}
